cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Variable length in substring

Former Member
0 Likes
355

i am trying unsuccessfully to write a udf, as suddenly the fixed length field i was using a substring on has changed to a variable length field...

i need to pass the field into a UDF and then pass out the last two characters for one field...

and the last 5 for another field.

once i have the UDF working for one, i can amend it for the other...

i am probably a million miles away from the solution... but this is where i am so far...

can someone guide me as to how i can pass the variable length into the substring parameter??


String str = var1;
int length = str.length();

output(var1.substring(length -2))

}

View Entire Topic
stefan_grube
Active Contributor
0 Likes

just one line:

return var1.substring(var1.length()-2);

What should "output" do in your example?

Former Member
0 Likes

the output was supposed to be the answer....

i was trying to learn from the Java guides... and then combine two solutions....

but thank you,... an elegant solution! 🐵