on 12-10-2013 1:29 PM
HI All,
I have the following UDF code which will parse the input XML and send some portion to the target element
String temp = a[0].substring(a[0].indexOf(b[0])+(b[0].length()));
String value = temp.substring(0,temp.indexOf("/")-2);
result.addValue(value);
Actual input should come is value="149433" /. Now the present input doesn't contain space after quotation symbol (value="149433"/)which is truncating the last digit(The output going is 14943 instead of 149433)
The above UDF will remove the last 2 characters and send the output to target field. The new requirement is the entire value should send to target field. Please advise how to achieve the requirement(with space"ation, without space and with quotation)
Hello,
Not sure what's the context of argument "b", but u can replace second line of ur code with the below one:
String value = a[0].replaceAll(" ","").substring(0,a[0].replaceAll(" ","").indexOf("/")-1);
So above statement will replace all the spaces present in the input value and then pass that value which is present before "/" (without any spaces)
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I have tested this code before pasting it here, so i am not sure what's not working for u?
As stated above, the code will remove all the spaces and only output the digits present before "/".
String value = temp.replaceAll(" ","").substring(0,temp.replaceAll(" ","").indexOf("/")-1);
Edited: Since u are performing some operation on input value a[0] in the first line of ur code so instead of a[0] use temp.
Thanks
Amit Srivastava
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
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.