String Manipulations In Uipath
String manipulation in UiPath refers to the process of modifying and manipulating text data using various string functions and methods. UiPath provides several activities and methods that allow you to perform common string operations, such as concatenation, splitting, replacing, extracting substrings, and converting the case of characters, among others.
Here are some common string manipulation activities in UiPath:
Replace :-This activity allows you to replace specific characters or substrings within a string with a new value. It is commonly used to remove unwanted characters or replace certain patterns in a string.
Here we have a date in the formate of “12-29-2023”, but i wan to remove inverted commas i need to write 12-29-2023 like this, for this i use Variable.Replace(“”””,””). Given below image
Trim :-The Trim activity is a built-in activity in UiPath that removes leading and trailing whitespace characters from a string. It takes a string as input and returns the trimmed string. This activity modifies the original string.
Ex:- Here i have a text “WELCOME TO RPA ZONE” in this i want only RPA ZONE for this we have to count the index numbers of the given sentence until where we want to trim we should give index number in the brackets like this variable.trim.substring(10). By using this expression we get only RPA ZONE.
Note :- Here we have to consider the space also an index number
String.Equals :- The string equals method takes two string arguments and returns a Boolean value indicating whether the strings are equal.
After executing the Assign activity, the is equals variable will contain true
if the strings are equal, and False
if they are not.
ToLower :-In UiPath, the ToLower
method is used to convert a string to lowercase. It is a string method that helps in performing case-insensitive operations on strings.
In the above image u can see the text “WELCOME TO RPA ZONE”. It has been converted into the lowercase “welcome to rpa zone” by using the string method ToLower.
ToUpper :- In UiPath, the ToUpper
method is used to convert a string to uppercase. It is a string method that helps in performing case-insensitive operations on strings.
In the above image u can see the text “welcome to rpa zone”. It has been converted into the Uppercase “WELCOME TO RPA ZONE” by using the string method ToUpper.
Below are some of the most common methods used in RPA.
String.concat :- Concatenates the string representations of two specified objects.
Expression: String.Concat (VarName1, VarName2)
Output datatype: String
Contains :- Checks whether a specified substring occurs within a string. Returns true or false.
Expression: VarName.Contains (“text”)
Output datatype: Boolean
String.Formate :- Converts the value of objects to strings (and inserts them into another text).
Expression: String.Format(“{0} is {1}”, VarName1, VarName2)
Output datatype: String
Indexof :-Returns the zero-based index of the first occurrence of a specified Unicode character or string within this instance.
Expression: VarName1.IndexOf(“a”)
Output datatype: Int32
LastIndexof :-Reports the zero-based index position of the last occurrence of a specified Unicode character or string within this instance.
Expression: VarName1.LastIndexOf(“author”)
Output datatype: Int32
String.join :- Concatenates the elements in a collection and displays them as String.
Expression: String.Join(“|”, CollVarName1)
Output datatype: String
Substring :-Extracts a substring from a string using the starting index and the length.
Expression: VarName1.Substring(startIndex, length)
Output datatype: String
In conclusion, string methods play a crucial role in manipulating and working with text data in programming languages like Java and UiPath. They provide a wide range of functionalities to help developers perform various operations on strings
I am very glad to see this website. I got this website through LinkedIn. I have completed my training but as a Fresher I learned a lot from this site.
Thank you so much for work you doing , god bless you.