cancel
Showing results for 
Search instead for 
Did you mean: 

Need to split value based on "+"

former_member350687
Participant
0 Kudos

Hi All,

I need to split my input value based on "+" symbol.

Sample Input Value : 4506407171+4506661488+4506661489+4506548333

Out put Value 1: 4506407171

Out put Value 2: 4506661488

Out put Value 3: 4506661489

Out put Value 4: 4506548333

Please suggest a UDF

Thanks & Regards,

Mahi.

Accepted Solutions (0)

Answers (2)

Answers (2)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Mahi,

The + sign is a special character and needs to be escaped before splitting. Please see code below:


UDF: Context Type

Argument: inp        (String)

for(int a=0;a<inp.length;a++){

  String tmp[] = inp[a].split("\\+");

  for(int b=0;b<tmp.length;b++){

  result.addValue(tmp[b]);

  }

}

Regards,

Mark

iaki_vila
Active Contributor
0 Kudos

Hi Mahi,

Check this thread

Change only - by +.

Regards.