How to use substring method for non-consistent wording?

0
Hi,  Anyone know how to solve my issue? I want to seperate this wording into two part. For example S810-001, I want to separate it to S810 and 001, for SAX260-001, separate it to SAX260 and 001. Currently, I just use substring method. but i don’t know how to find the symbol “-” between the two parts because the wording is not consistent.    
asked
3 answers
2

Hi Muhammad Ikhwan Afiq bin Azmir,

 

For the left side of the hyphen use:

substring($Source/FileTaggingNumber, 0, find($Source/FileTaggingNumber, '-') )

 

The right side:

substring($Source/FileTaggingNumber, find($Source/FileTaggingNumber, '-') +1 ,length($Source/FileTaggingNumber) - find($Source/FileTaggingNumber, '-')-1)
 

Go Make It

answered
5

Hi Muhammad ,

You can use StringUtils module :

follow some step to do it :

  1. Download the StringUtils module in marketplace.

     In this module many java actions are there for you issue use SubstringAfterLast java action 

  1. Using you appropriate microflow add java action and call SubstringAfterLast .

  1.  It contain two parameters one is your string another one is your separator 

  1. save the retrun value and the retrun value is after the – .

Output:

 

Thank you 

Hope it help you !!!

 

 

answered
1

Hi,

 

You can use find string function like this:

 

You can then use the check !=-1 to use the index to modify the string using substring.

 

Regards

answered