Tokenize with String split function

0
Hello Experts, we have a use case wherein a string like this "bob$testdata$Result123$001" has to be tokenized with the “$”  delimiter. Then ignoring the index value 0, I just need to capture the index values 1, 2 and 3 into separate variables. Appreciate if you can share some info on how to use the split function or some sample microflow to achieve the above.
asked
4 answers
0

Community Commons Module’s StringSplit Java Action might help you.

answered
0

Kalyan,

Create a microflow like this:

Here is the string variable

here is the StrSplit Java action

This will return a list of objects you can loop through to accomplish what you want.

Hope that helps,

Mike

answered
0

Hi Mike,

      I actually did what you suggested, but am just having issues looping through the split strings and getting the specific index and its corresponding value. In my example, if the strings are split, then I should have the loop go through 4 times and each index should have one split string. However, after the first iteration, it shows me index as 0, value as "bob$testdata$Result123$001". My expectation was, the value would contain “bob” and that was not what I noticed.

     My interest is only to capture testdata, Result123 and 001 values and set them into one of the entity specific attributes.

      Any help on the looping part will be appreciated.

   

 

 

answered
0

Experts,

        I was finally able to get the Split string function working to my need. Just an FYI that since I had ‘$’ as delimiter in my string, this java action expects an escape character before that. Had it been  a comma or any other delimiter this java action works pretty well. Anyways, my problem is resolved now.

       Thanks a lot to Mike and Bhanu.

answered