on 12-30-2010 7:36 AM
Hi,
can any one please provide an udf to split single value into mulitple using separator &, I have one field data as-PO&1100000001&&32424234234&. here PO is constant concated with three values in reverse order.
i.e first value A-32424234234 ,second value B- blank,third value C-1100000001.
i need to map the splliting values to target side(A->A,B->B,C->C).
regards
Mahesh.
Hi,
Try this:
Input: Var1
Execution type: All values of a context
String delimiter ="&" ;
String[] temp = var1[0].split(delimiter);
int a = temp.length;
for(int i = a-1; i>0; i--)
{
result.addValue(temp<i>);
}
Thanks
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
convert below code in to UDF, it will work..
public class StringSplit {
public static void main(String args[]) throws Exception{
String testString = "PO&1100000001&&32424234234&";
System.out.println(java.util.Arrays.toString(
testString.split("&")
));
}
}
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amol,
can you please provide more detial on this with respective to udf code and relvant imports.
regards
mahesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Using String Tokenizer you can acheive this.
Rerer below blog:
Link: [http://wiki.sdn.sap.com/wiki/display/Java/String+Tokenizer]
Regards
Amol
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
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.