String Manipulations in UiPath

There are several methods which can be used while implementing String Operations on input String.

List of String Methods:

Length, Replace, Format, Substring, Split, IndexOf, Trim, Remove, Join, ToUpper, ToLower, PadLeft, PadRight, Insert, Concat, CompareTo, Contains, IsNullOrEmpty.

String Conversions:

Conversion from String to Int, Double, List, DataTable, Collection.

String.Length

Example1:

Input:

Output:

String.Replace

Example2:

Input:

Output:

String.Format

Example3:

Input: Text file, Send SMTP activity

Note: If using SMTP, enable less secure apps and POP,IMAP under settings for your email account.

Syntax: String.Format(pass a string/file name, pass a value/variable/argument)

Output:

Example4:

Input:

Output:

String.Substring

Example:5

Input:

Output:

Example6:

Input:

Output:

String.Split

Example7:

Input:

Output:

Example8:

In this example, my input text file has four lines of data. I need to extract data after “:” each line.

Input: Text file

Output:

The count is 7 because 4 lines + 3 newline characters

String.IndexOf

Example9:

Input:

Output:

Example10:

Input:

Output:

String.Trim:

Example11:

Input:

Output:

Example12:

Input:

Output:

Example13:

Input:

Output:

String.Remove:

Example14:

Input:

Output:

Example15:

Input: String Array

Output:

Example16:

Input:

Output:

Example17:

Input:

Output:

Example18:

Input:

Output:

Example19:

String.PadLeft, String.Insert:

Input:

Output:

String.PadRight, String.Insert:

Example20:

Input:

Output:

Example21:

String.Concat:

Input:

Output:

String.CompareTo:

Note: s1==s2 returns 0  s1>s2 returns 1  s1<s2 returns -1  

Example22:

Input:

Output:

String.Contains:

Example23:

Input:

Output:

String.IsNullOrEmpty or String.IsNullOrWhiteSpace:

Example24:

Input:

Output:

String Conversion:

You can convert from String to different types like int, double, decimal, datetime.

Example1:

Input:

Convert from String to Int:

Convert from String to Double:

Output:

Example2:

Convert String to List and get specific value from the list.

Input:

Initialize the List variable as below:

Output:

Example3:

Convert String to DataTable.

Input:

Create a Datatable with Index and color column names.

Output:

Example4:

Convert String to Dictionary.

Input:

Since dictionary is key-value pair, index is key, and value is color.

Initialize the dictionary variable as below:

Output:

We hope you enjoyed the article!!

You can connect with Kishori Afzulpurkar, she is always happy to help. 🙂

Thank you!!

2 thoughts on “String Manipulations in UiPath

  1. varasen

    Excellent and very informative you people are rocking

  2. Pavlo Gavlo

    This is a great website. Thank you for these information – very useful.

Leave a Reply

%d