on 06-17-2008 11:59 AM
Hello gurus ,
I need a java code to split a string coming from source side to target 3 elements
For example i am getting a value"INDIA WON MATCH" from source side string value.
I need to split it into three values say
variable one towards the target side needs "INDIA"
Variable 2 need"WON"
Variable 3 needs"MATCH"
hi,
Create a Value user defined function and name it as replace. Take one argument as a.
Import: java.*;
Add this code:
int i = a.indexOf(" ");
a = a.substring(0,i);
return(a);
Then map like this:
source --> replace(udf) --> Target
This will always take the value before -.
Thanks,
Vijaya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should opt Advanced UDF
function myudf(String a, ResultList result, Container container)
{
String [[]] temp = null;
temp = a.split(" ");
for (int i = 0 ; i < temp.length ; i++) {
result.addValues(temp[<i>]);
}
make targe node as o..unbounded.
source msg> myudf>splitbyByValue(each Value)>CollapseContext>Target node
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Write an UDF something like this.
define a result String array in which u will return the values. lets sat its result[] of type String
//write your code here
String res = "";
for(int i = 0;i<xmlString.length();i++)
{
if(xmlString.charAt !='')
{
res = res + xmlString.charAt (i);
}
else
{
Add values to your String Array;
reset value of string res; //to take next values
}
}
return result[];
hope this will help you.
Regards
Aashish Sinha
PS : reward points if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There is a process in graphical mapping look at the below blog, its done in graphical mapping
/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
Thanks
Vikranth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
String input = "INDIA WON MATCH"
String [ ] StrArray = input.split(" ");
variable1 = StrArray[0];
variable2 = StrArray[1];
variable3 = StrArray[2];
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
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.