on 02-08-2013 2:11 PM
Hi,
I need to remove the last three characters of a given string It should be for the entire queue.
Let me know the udf for this as I assume it can't be achieved using standard functions.
Regards
Anandh
Hi,
Try with
return str.substring(0,str.length()-3);
Thanks
Anand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anandh,
What do you do if the string in question is less than three characters in length? Return the empty string?
Regards,
Ryan Crosby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
You can try this UDF.
public static String removeLastChar(String s, int pos) {
String sResult = null;
if (s.length()- pos > 0)
sResult = s.substring(0,s.length()- pos);
else
sResult = s;
return sResult;
}
Regards
Lucho.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anandh,
You can use substring and achieve this.
double click on substring and provide the parameters.
starting position =
number of characters =
Regards,
Naveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.