Sorting string items

Hi guys, Does anyone know how to sort string items?   I have an attribute (Lot No.) string that combined numbers and letters. For example : 544M1001,544M1003,544M1005,544M1002,544M1004 I want to sort it to : 544M1001,544M1002,544M1003,544M1004,544M1005   Does anyone know how to solve this problem?
2 answers

With string manipulations. See also the documentation here:

You first need to cut the string up by using the comma. Use the findfirst and substring to create the pieces. Store those pieces in a non persistent object. After you cut everything up (ie no comma can be found anymore) your list of non persisten objects can be used to just sort that list. Then iterate over the list to create the string again and put it back.





Hi Muhammad Ikhwan Afiq bin Azmir,

The solution provided by  Ronald has mentioned is absolutely correct, but it will be easy to use Split String java action from the community commons module. In your microflow, you can use StringSplit java action with key as  ‘ , ’ in your case, the above java action will return a list object from the string with, separated, after the java action you use List operation Activity and use Sort option. Then Iterate over the list and recreate your string in the format you want.