String Comparision In UIpath

In this tutorial I will discuss about how to compare to two strings in uipath rpa

First lets take two string type variable in variable panel in uipath studio
 as shown below

 Here in example I have taken 2 string type variables where we can do comparison and compare_result variable will hold the result of comparison of strings.

Syntax is :

As shown below

  Here CompareTo will give 3 possible outputs

0 -When both strings are lexicographical correct
1-If first string is lexicographical more than second string
-1 -If first string is lexicographical less than second string

Here comparison happens in below manner

1)First Character in first string will compared by first character in second string  - if first character from first string is more than first character from second  then returns "1",else less than returns "-1"
if both are same  then comparision between second character happens between the strings like above.

I have explained in the below example


About author


Tech enthu, owner of kbtutorials youtube channel

Leave a Reply