Full proof string comparison

New to UIPath and having difficulties with string comparison.

My activity uses Get Text Method to grab the text from within a div in a browser.

I then want to compare that text to a string variable to see if I have certain error messages.

So I grab str_Var from the web site, and obviously str_Var is of type string.

Then in an if statement I want to do a comparison, like so:

String.Equals(str_Var,“This is error 1”,StringComparison.InvariantCulture)

I have tried many different variations on this and sometimes I have to put in a Trim, or I need to take the second text string and strip invisible characters out of the string using some other tool (in my case BBEdit).

Can see that this is going to be a perenial problem.

Is there some function someone has written that when passing in 2 strings will do all this work for me and just return a boolean. I want to compare the content of 2 strings (not the object types) and compare them ignoring case. Would like to solve this once and not have to deal with it over and over.

@Bryan_Schmiedeler
Are you looking for this:
grafik
CaseInsensitive Check?

Along with Trim
String.Equals(“aBc”.Trim(),“ABC ”.Trim(), StringComparison.InvariantCultureIgnoreCase)
Variant:
grafik

Mabye Contains helps as well due ignoring the error no: