on 06-02-2010 11:23 AM
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))
}
just one line:
return var1.substring(var1.length()-2);
What should "output" do in your example?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try;
int length = input.length();
String out = input.substring(length-2,length);
return out;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.