Compare two variable's value

Hello guys,
can anyone help me out here:
How I can check whether one variable’s value contains some part or complete value of another variable? For example, 1-st variable’s value is a text scraped from pdf (with get full text function), and the second variable’s value is a text scraped from the website (with scrape screen with OCR function).
Thank you.

Hi @Artur_Martirosyan,

Check variable1.Contains(variable2)

I tried, that but it does not work.

If the variable is not a string you need to add .ToString

If that doesn’t help, can you provide what errors you are getting or screenshot of the workflow activity/properties you are using?

Hello, I tried this one, the problem is, it does not show any errors, it’s juts doesn’t choose the right path, always gives the same decision like variable1 does not contain variable 2. It always takes the path where it says don’t send the email

You need to output partner1 and partner2 as well as name before these conditions and make sure you are looking at the correct string and that name is contained in one of them.

You can output the variables using a Message Box or a Write Line that shows in Output tab.


thank you so much, will try and update accordingly.

I used message box but still the same result.

You need to check them right before the If condition. There could be some mistake where the variables get changed before the conditions.

Also, show what the variables equal exactly during the run, so we look at them and identify the problem.


During the run time the variable “name” is “Art International GmbH, Bettinastraße 30, 60325 Frankfurt am Main, DE”
the variable “partner1” is “Art International GmbH, Bettinastraße 30, 60325 Frankfurt am Main, DE”
variable “Partner2” is “Business Consulting house GmbH Bettinastraße 30, 60325 Frankfurt am Main, DE”
And just right now I used three different message boxes in front of if condition but still the same result.
I even tried variable1 = variable2 structure,
still the same result
it’s seems it passes through these steps without actually performing the steps

Sometimes end spaces can cause some problems. Try adding some random characters on the ends of the variables when outputting them, like “aaa”+name+“aaa”
This will show if there are end spaces.

If it is the reason, then you can add that in the condition. Also, it might make sense to convert both variables to upper or lower case so it is not case-sensitive.


Other than that, I’m not sure because the strings you are showing should match up. I would look very closely for any characters or spaces in the string that may make it different.


thank you so much for the support.
Kind Regards

Please try:

Hope it helps :robot:

by trying this method
partner2.Trim.Contains(name) "
got the same result.

i wonder, i tried it and it is working for me.stringCompare.xaml (7.6 KB)

your variables are not String type?
Share you xaml if still not working

Trim your name variable as well because it may contain other invisible characters like \r\n and then check. You can use write line activity for all variables and then check message details for invisible chars by double clicking the line in the output panel like below:

here is the xaml file.

ops sorry, I am a new user and this site does not allow me to share xaml. :roll_eyes::roll_eyes:

Try with ToLower to compare strings, sometime it will not work direct Contains.