String.Equal is not working as Expected

Team - I have to compare 2 strings. The get text activity only I made as expected in excel by write activity and reading again the text and comparing with (String 1).Replace(" “,string.Empty).Trim.Equal( String 2).Replace(” ",string.Empty).Trim

robots.txt for sfdc appservers.

For use by salesforce.com

User-agent: * # applies to all robots
Allow: /?un=&pw=*
Allow: /?pw=&un=*
Allow: /secur/frontdoor.jsp?sid=
Allow: /secur/contentDoor?sid=
Allow: /secur/myDomainDoor?sid=
Allow: /secur/LoginInterstitial.apexp
Allow: /secur/login_portal.jsp?pw=
Allow: /sserv/login.jsp?pw=
Allow: /login.jsp?pw=
Allow: /login/login.jsp?pw=
Allow: /secur/login_page.jsp?pw=
Disallow: / # disallow indexing of all pages"

Both of these String 1 and String 2 when populated with Message box or logs looks exactly same but equal commmands is resulting in false. Can you please suggest some workaround to this.

String.Equal definitely works, as does simply using equals or alternatively contains (if appropriate). Note they are case sensitive so you may want to convert .tolower first.

Best thing to do is log the outputs separately so you can see exactly what UiPath is comparing. Be careful to log the exact strings that you are comparing e.g. don’t use string.replace.trim in the comparison but only log string.replace as that will not be the same thing.

RD

I can show case , I did everything , logs and message box it looks exactly same but still failing.

Hi there @rajiv_mnit,
It may be worth writing both values into separate text files, then copying the data into:

This will assist you in identifying any minute differences.

1 Like

I agree with this, it’s better to compare the texts using Text Compare