on 12-16-2009 8:43 AM
hi all,
i have a dilemma regarding substring. i need to cut a value based on the first character. foe example, file-123888. I need to get the characters after the - symbol. Result should be 123888. I know I have to use a UDF but I'm not that good in JAVA. Please help
Thanks!
IX
I'd go for an even more "flexible" way :
String substr = str.substring(str.indexOf("-")+1,str.length());
so you do not need to declare static position and length and if the begin pattern changes, it will deal with it
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I need to get the characters after the - symbol.
Means u want all the things after "-".
and the length may vary also after "-".
So please use the
String k = "abc-addd";
System.out.println(k.substring(k.indexOf("-")+1));
Thanks & Regards
Babu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Search in sdn,you wil find the code for the same,
it is very easy pass input to the udf and use substig function
str is here your input
String str = string.substring(6,11);
retunr str;
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.