Sometimes we might want to break down a string datatype value into an array of substrings based on some separator.
A separator can be a space, a comma, a newLine e.t.c
Let’s see how to do that!!!
Where,
1.Input is our input String value
2.Result is our output List
3.Separator is the desired delimiter ex: comma, space, hyphen e.t.cInstall “Microsoft.Activities” Package ,if you don’t find the split activity in your activities panel
Example
Implementation using UiPath :
Let’s develop a project which takes a string value consisting of numbers separator by comma and displays the values.
Step 1:
Drag “Assign” activity into the designer panel and initialize the string variable with some sample data as shown below.
numbers_Data = “1,2,3,4,5”
Step 2:
Drag “Split String” activity into the designer panel and supply the below-mentioned parameters.
Input: numbers_Data
Result: result_List
Separator: “,”
Step 3:
Drag “For Each” activity into the designer panel and supply the above-created list variable to it.
Then, drag “Message Box” activity to display the values available in the list variable.
Step 4:
Finally, execute the project to display all the values available in the list on by one!!!
Click here to download the Source Code…
Hope it has helped you…
To explore more string manipulations, click here