on 11-12-2009 7:36 AM
Hi XI masters,
Does anyone know how to cut an input so that only the first numbers would be left?
Ex. 100_hello -> 100
98_hello -> 98
1000_computer -> 1000
I tried using substring (0,3) then I realized that the numbers could have different digits. They are not always 3.
Hi,
This is only possible via UDF.
UDF type is ContextType,
input argument is input
for(int a=0;a<input.length;a++){
result.addValue(input[a].substring(0,input[a].indexOf("_")));
}
hope this helps,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this one !!!
public String beforeUnderScore(String a, Container container)
{
String arr[] = a.split("_");
return arr[0];
}
Regards,
Sunil Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.