In UiPath Studio development, there are many times when you need to check and determine strings.
In this article, we will show you how to check if a string contains null, empty, or blank space, or if it matches a specified string, with samples.
\Save during the sale period!/
Take a look at the UiPath course on the online learning service Udemy
*Free video available
Related Articles Learn the Creation Techniques f UiPath robotics creation with Udemy’s online courses that take it up a notch
This site was created by translating a blog created in Japanese into English using the DeepL translation.
Please forgive me if some of the English text is a little strange
Check if a string is null, empty, or blank-paced.
Check if the string is null or empty (IsNullorEmpty)
To check if a string is null or empty, use IsNullorEmpty.
Code to check if a variable of type String “str1” is null or empty
String.IsNullOrEmpty(str1)
- First value in (): string to be checked
・Sample Process
・Execution result
Check if the string is null, empty or white space (IsNullOrWhiteSpace)
To check if a string is null or empty, use IsNullOrWhiteSpace.
Code to check if a variable of type String “str1” is null or empty
String.IsNullOrWhiteSpace(str1)
- First value in (): string to be checked
・Sample Process
・Execution result
Check if the string contains the specified string.
Check if the string contains the specified string (Contains).
Use Contains to check if the string contains the specified string.
Code to check if the String variable “str1” contains “ab”.
str1.contains("ab")
- First value in (): string to search
・Sample Process
・Execution result
・Other samples and execution results
Left side of // is code, right side of // is output result
str1 = "abc123"
str1.contains("a") //True
str1.contains("b") //True
str1.contains("ab") //True
str1.contains("z") //False
str1.contains("az") //False
str1.contains("a1") //False
str1.contains("c1") //True
str1.contains("123") //True
str1.contains("1234") //False
Check if the string matches the specified string (Equals)
Use Equals to determine if the string matches the specified string.
Code to check if the variable “str1” of type String matches “abc123”.
str1.Equals("abc123")
- The first value in (): the specified string to search.
・Sample Process
・Execution result
・Other samples and execution results
Left side of // is code, right side of // is output result
str1 = "abc123"
str1.Equals("abc123") //True
str1.Equals("abc") //False
str1.Equals("12") //False
str1.Equals("abc12345") //False
str1.Equals("ABC123") //False
str1.Equals("ABC123", StringComparison.CurrentCultureIgnoreCase) //True
Check if the string matches the specified string forward (StartsWith).
Use StartsWith to determine if the string starts with the specified string.
Code to check if a variable of type String “str1” is a forward match for “ab”.
str1.StartsWith("ab")
- The first value in (): the specified string to search.
・Sample Process
・Execution result
・Other samples and execution results
Left side of // is code, right side of // is output result
str1 = "abc123"
str1.StartsWith("a") //True
str1.StartsWith("b") //False
str1.StartsWith("z") //False
str1.StartsWith("abc12") //True
str1.StartsWith("ab123") //True
str1.StartsWith("ab1234") //False
str1.StartsWith("ABC") //False
str1.StartsWith("ABC",StringComparison.CurrentCultureIgnoreCase) //True
Check if the string matches the specified string backward (EndsWith)
Use EndsWith to determine if the string ends with the specified string.
Code to check if a variable of type String “str1” is backward matched with “23”.
str1.EndsWith("23")
- The first value in (): the specified string to search.
・Sample Process
・Execution result
・Other samples and execution results
Left side of // is code, right side of // is output result
str1 = "abc123"
str1.EndsWith("3") //True
str1.EndsWith("2") //False
str1.EndsWith("23") //True
str1.EndsWith("ab") //False
str1.EndsWith("abc123") //True
str1.EndsWith("C123") //False
str1.EndsWith("C123", StringComparison.CurrentCultureIgnoreCase) //True
summary
- Use IsNullorEmpty and IsNullOrWhiteSpace to check if the string is null, empty, or blank space.
- To check if the string contains the specified string, use Contains, Equals, StartsWith, and EndsWith.
- Since IsNullorEmpty, Contains, and Equals are the most frequently used, please learn them first.
\Save during the sale period!/
Take a look at the UiPath course on the online learning service Udemy
*Free video available
Related Articles Learn the Creation Techniques f UiPath robotics creation with Udemy’s online courses that take it up a notch
same category UiPath

Japanese IT engineer with a wide range of experience in system development, cloud building, and service planning. In this blog, I will share my know-how on UiPath and certification. profile detail / twitter:@fpen17