Comparing string

Hello i face the same issue i can display correctly the 2 strings but even if they are equal when i apply this string1.trim.tolower = string2.trim.tolower or String1.ToString.Contains(String2.ToString) i have a boolean false as a result please help me i am working on it since friday thanks

Hi @bentchikou3,

Possibly the space characters are not the same. Could you try str.replace(" “,”") instead of trim.

You can compare for each character and capture the character that actually looks the same but is different. In general, the characters may not be the same when copied from somewhere.

Regards,
MY

Thank you i will try it now and let you know

i will write in my if condition this
String1.replace(" “,”“).ToUpper=string2.replace(” “,”").ToUpper

Hello,

Can you try to use .ToLower while comparing as well?

Thanks!
Athira

can you please use the immediate panel and show us the values from str1 and str2

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Try string1.trim.tolower.equals(string2.trim.tolower).

equals() is more accurate than =.

Regards,
Saloni

here is the value from the output panel i have value from excel and the related value from the web site

this if condition SitewebValeur.Trim.ToUpper.Contains(DomainExcelValeur.Trim.ToUpper)
does not work and
this
SitewebValeur.replace(" “,”“).Tolower.equals(DomainExcelValeur.replace(” “,”").Tolower)
it does not work too

Please help me

As per your output in String1 GB and in String 2 FR Not Matches strings.
So it will Give you a False value when you Compare.

If you only want to compare PEUGEOT try this.
Strvar1.split("-“c)(0).trim.equals(Strvar12.split(”-"c)(0).trim)

Regards,
Saloni

Are you trying to check if Peugeot From “Peugeot - GB” is contained in “Peugeot - FR”

If so, then the task would be to extract Peugeot from fist string

i would like to compare string from excel file which is

also have a look here:
grafik

with a string from a table in the web site which is this one

As you shown in above image
PEUGEOT - GB, PEUGEOT - FR, PEUGEOT - DE all are Different strings.

If you only want to Compare PEUGEOT from all the strings than You have to split the string as mentioned above.

or let me know if you want any other solution.

Regards,
Saloni

Peugeot GB vs. Peugeot BG is maybe driving the result but different expected

i would like to compare for instance the string from the excel file which is this value


with any string from the table in the web site

if they are eqaul i will click on the related string in the table from the website