How To Split A String – In UiPath

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!!!

UiPath Split a string 1UiPath Split a string 2

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.c

Install “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”

UiPath Split a string 3.PNG

Step 2:
Drag “Split String” activity into the designer panel and supply the below-mentioned parameters.

Input: numbers_Data
Result: result_List
Separator: “,”

UiPath Split a string 1UiPath Split a string 4

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.

UiPath Split a string 5

Step 4:
Finally, execute the project to display all the values available in the list on by one!!!

UiPath Split a string 6.PNG

Click here to download the Source Code…

Hope it has helped you… 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: