If activity - on String

Hi All,

how can we compare two strings if 1st string say varString1 contains a complete line such as “ARaruna, rai aruna@testmail.com, 00999834893” and other variable let say varString2 contains two word from that line which may be “aruna, rai” or “rai, aruna” but when we comapre these two strings it returns true

when I am using varString1.Contains(varString2) it returns true if varString2 has value “aruna, rai” but for “rai, aruna” it returns false

So please suggest which String comparison method should I use so that whether it is “aruna ,rai” or “rai, aruna” it returns true always as both variables are fetching values dynamically and sometime value varString2 get is “firstname, lastname” and sometime it gets “lastname, fistname”


When a string is about: text ABC, CDE text
then only ABC, CDE is contained in the String, But not CDE, ABC
for sure this is evaluated on string value

In you case we do fee, that a ordering / other ordering of Name,Prenames is to handle

One of many options

Assign Activity:
arrNameSplits | String Array =
varString2.Split(","c).Select(Function (x) x.Trim.ToUpper()).toArray

If Condition:
arrNameSplits.All(Function (x) strVar1.ToUpper.Contains(x))

it will retrun when all items ARUNA And RAI will be found

We can also adapt and modify just to mention one of many options

Hi @sgarg

Try this
varString1.Contains($“{varString2.Split(”,“)(1).Trim}, {varString2.Split(”,“)(0).Trim}”)

Hope this helps

Thanks for your help, it helped me but the condition that worked for me was below:

varString1.Contains(varString2.Split(”,“)(1).Trim) And varString1.Contains(varString2.Split(”,“)(0).Trim)