Practice Exercise-String Manipulation-2
Build a workflow using Split and Contains methods that extract sentences containing “RPA”
from a paragraph
- Store a paragraph in a string variable using an Assign activity
- Store all sentences from the text in an array using a Split method
- Loop through each sentence and identify sentences containing “RPA” using Contains
method
- Store all identified sentences in an MS Word file
• START
• Use an Assign activity to store a paragraph in a string variable called newText
• Use [Link](“.”c) and store all sentences in an array called newSentence
• Use a For Each activity and iterate through each item in the array newSentence
• Use an If activity within the For Each activity to identify sentence that contains the
string “UiPath in it. Use [Link](“RPA”) as condition
• Use a Type Into activity to store result in an MS Word file
• STOP
Step 1: Open a new MS Word file.
Step 2: Open Studio.
Step 3: Create a new process and name it as “String Manipulations – Practice 2”
Step 4: Drag a Sequence activity from the Activities panel and drop it in the Designer
panel.
Step 5: Name the Sequence activity as “Sequence – ‘This code is to demonstrate the use
of Split and Contains method.’”
Step 6: Right-click on the Sequence activity container and select Annotations from the
context menu.
Step 7: Enter the annotation “This block of code demonstrates a workflow using Split
and Contains methods that extract sentences containing “RPA” from a
paragraph”.
RPA Specialization | Data Manipulation in RPA 1|Page
June 2022
Practice Exercise-String Manipulation-2
Step 8: In the Variables panel, create variables as shown below:
Name Variable type Scope Default
newText String Sequence - This code is to Demonstrate the
use of Split and Contains.
newSentence String[] Sequence - This code is to Demonstrate the
use of Split and Contains.
Step 9: Drag an Assign activity and Drop it into the “Sequence - This code is to
Demonstrate the use of Split and Contains.”.
Step 10: Name the Assign activity as “Assign - Message”, add an annotation: “This
message is stored in the variable: newText” and enter the values as shown
below:
To Value
newText "Robotic process automation (RPA) is a software technology that
makes it easy to build, deploy, and manage software robots that
emulate human actions interacting with digital systems and software.
RPA streamlines workflows, which makes organizations more
profitable, flexible, and responsive. RPA is non-invasive and can be
rapidly implemented to accelerate digital transformation. It also
increases employee satisfaction, engagement, and productivity by
removing mundane tasks from their workdays. "
Step 11: Drag and drop another Assign activity and place it after the first Assign activity.
Step 12: Name the Assign activity as “Assign - Split sentences and store it in an array.”,
add an annotation: “String Manipulation -Split string” and enter the values as
shown below:
To Value
newSentence [Link](“.”c)
RPA Specialization | Data Manipulation in RPA 2|Page
June 2022
Practice Exercise-String Manipulation-2
Step 13: Drag and drop a For Each activity, add an annotation: “Loop iterates for each
item in newSentence” and in the first box enter item and in the second box enter
newSentence. Change the “Type Argument” property of For Each activity as
“String”.
Step 14: In the Body section of the For Each activity, drag and drop an If activity. Name
it as “If - item contains word "RPA"”, and add an annotation: “This activity
judges whether the sentence contains word ‘RPA’.” and enter condition as
[Link]("RPA")
Step 15: Drag and drop an Attach window activity, place it in the Then section of the If
activity and name it as “Attach Window - MS Word”. Add an annotation:
“Attach MS Word window”.
Step 16: Click on the “Indicate element on screen” link and select the MS Word window.
Step 17: Drag and drop a Type Into activity in the Do container of the Attach Window
activity and name it as “Type Into - MS Word”. Add an annotation: “Types each
item in the word file.”
Step 18: Click on the “Indicate element on screen” link and select editor area of MS
Word.
Step 19: In the text area of the Type Into activity enter expression: [Link]+
"[k(enter)]"
Step 20: Save and Run the workflow.
RPA Specialization | Data Manipulation in RPA 3|Page
June 2022