If multiple strings are different


I have a robot that generates 3 figures (as strings). These should all be different, so I want to include a logic check to ensure this. However, I am a bit stuck…

Basically I want to use an IF A =/= B =/= C, but I don’t know how to right this?


To use a IF and string comparison in UiPath you can use :

not A.equals( B ) and not A.equals( C ) and not B.equals( C )

Have fun

1 Like

If StrA, StrB and StrC are your String Variables, then declare a Boolean Variable, say ValidStringFlag. Write an Assign statement as below:

ValidStringFlag = (StrA<>StrB) And (StrA<>StrC) And (StrB<>StrC)


You can have this logic in IF Condition

Not ((strA=strB) or (strB=strC) or (strA=strC))

1 Like

For your If conditional:

A <> B AndAlso A <> C AndAlso B <> C

I suggest AndAlso because it uses short circuit evaluation. If A = B, the process will not check the others and determine that the criteria has already failed to be met. This saves on execution time.

FYI the counterpart to this related to karthick’s example is Not ( A = B OrElse A = C OrElse B = C).

since he needs all to be different then he needs the later one: Not (A=B OrElse A=C OrElse B=C) :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.