Practice Exercise-String Manipulation-1
Build a workflow using Format, Join, IndexOf, Split, and Substring methods that extract
key information from a text and prints in a different format.
- Use the text "You always wanted to study Automation Training. The materials are
available in the following places: UiPath Blog, UiPath Academy.” for extraction
- Extract “Automation Training” from the first sentence
- Extract “UiPath Blog” and “UiPath Academy” from the second sentence
- Display “get Automation Training from: UiPath Blog; UiPath Academy” in a message
box
• START
• Use an Assign activity for the initial value of the message string variable: "You
always wanted to study Automation Training. The materials are available in the
following places: UiPath Blog, UiPath Academy."
• Create a new String variable study and use a succession of String methods to assign
the course from the query:
[Link]("."c).[Link]([Link]("study"))
o Split("."c).[Link] extracts the first sentence of the String and
converts it to a String
o Substring([Link]("study")) extracts the Substring starting
from "get"
• Create a new List variable places and use a succession of String methods to assign the
places from the query:
[Link]("."c)(1).[Link](":"c).[Link](","c).ToList
o [Link]("."c)(1).ToString extracts the second sentence of the String
and converts it to a String
o Split(":"c).[Link] splits the remaining string and keeps only the last
part of it
o Split(","c).ToList takes each string separated by comma and adds it as an
element in the List variable
RPA Specialization | Data Manipulation in RPA 1|Page
June 2022
Practice Exercise-String Manipulation-1
• Use a Message Box activity to display output using this expression:
[Link](“{0} from: {1}”, study,[Link](“;”, places))
o [Link] is used to extract each element in the “places” List variable and
display them
• STOP
Step 1: Open Studio.
Step 2: Create a new process and name it as “String Manipulations - Practice 1”.
Step 3: Drag a Sequence activity from the Activities panel and drop it in the Designer panel.
Step 4: Name the Sequence activity as “Sequence – ‘String Manipulation.’”.
Step 5: Right-click on the Sequence activity container and select Annotations from the
context menu.
Step 6: Enter the annotation: “This block of code demonstrates a workflow that performs
string manipulation on a pre-defined Message.”
Step 7: In the Variables panel, create three variables as shown below:
Name Variable type Scope Default
message String Sequence - String Manipulation
study String Sequence - String Manipulation
places List<[Link]> Sequence - String Manipulation
Note: To set the variable type of the variable places as List<[Link]> click on the
Variable type in the Variables Panel and select ‘Browse for types…’ from the dropdown. This
opens a new window. In the Type Name column of this new window search for
‘[Link]<T>’ and then select ‘String’ from the dropdown and click
OK.
Step 8: Drag and drop an Assign activity in the Sequence activity and name it as “Assign-
Message”. Add an annotation “Pre-defining the message” and enter values as shown
below:
RPA Specialization | Data Manipulation in RPA 2|Page
June 2022
Practice Exercise-String Manipulation-1
To Value
message "You always wanted to study Automation Training. The materials are
available in the following places: UiPath Blog, UiPath Academy."
Step 9: Insert another Assign activity and name it as “Assign- Extracting (Automation
Training)”.
Step 10: Right-click on the Assign activity container, and select Annotations from the context
menu.
Step 11: Add annotations shown below:
“1. Split("."c).[Link] extracts the first sentence of the String and
converts it to a String
2. Substring([Link]("study")) extracts the Substring from
"study"”
Step 12: In the Assign activity, enter values as shown below:
To Value
study [Link]("."c).[Link]([Link]("study"))
Step 13: Insert another Assign activity and name it as “Assign – Extracting (UiPath Blog and
UiPath Academy)”.
Step 14: Right-click on Assign activity container, and select Annotations from the context
menu.
Step 15: Add annotations as shown below:
“1. [Link]("."c)(1).ToString extracts the second sentence of the String
and converts it to a String.
2. Split(":"c).[Link] splits the remaining String and keeps only the last
part of it.
3. Split(","c).ToList takes each string separated by a comma and adds it as an
element in the List variable”.
RPA Specialization | Data Manipulation in RPA 3|Page
June 2022
Practice Exercise-String Manipulation-1
Step 16: In the Assign activity, enter values as shown below:
To Value
places [Link]("."c)(1).[Link](":"c).[Link](","c).ToList
Step 17: Insert a Message Box activity and right-click on Message Box container, and select
Annotations from the context menu.
Step 18: Add an annotation “In this expression, [Link] is used to extract each element in
the “places” List variable and display them”.
Step 19: In the text area of the Message Box activity enter the expression:
[Link](“{0} from: {1}”, study ,[Link](“;”, places))
Step 20: Save and Run the workflow.
RPA Specialization | Data Manipulation in RPA 4|Page
June 2022