How to check array value and string is equal in uipath?


I have an array like countryarray = {“US”,“Europe”,“Canada”,“Australia”,“Singapore”,“United Arab Emirates”}
and string like country = “Canada”

I want to check countryarray contains country string.
any solution for this??

1 Like


try countryarray.contains(“Canada”)

searchStringinArray.xaml (5.7 KB)


Hi @sams,

Use countryarray.Contains(country). you can put this statement inside an IF to check whether that country exists or not.

Please let me know if doesn’t work.


1 Like

thanks for reply @pathrudu,

I had tried like countryarray.contains(counrty).
I have object in contains() argument.

you might be getting the object from for each? if yes you can change type argument in foreach activity to string from object and can use directly or you can use country.tostring

please check and let me know


country.xaml (13.6 KB)

please check this one

are you getting error at final message box? i can’t run this process as i don’t have access to Linkedin.
but itried with different website i am getting perfect output. what issue are you facing here?

In final message box it add or subtract the score.
if array contain the location then it add other wise it subtract the value

condition every time goes in else part.


use this workflow, it should work.
country_v1.xaml (13.5 KB)



No, its not working,

In array United Arab Emirates is there and location is also United Arab Emirates value,

it return false in message box .


can you please share the screenshots of your message boxes, because I could able to run it properly
you are taking last value of your array please check there might be “.” included.


Please review this one.

did you used the file which i shared to you? please trim your location variable after assigning array variable so that all the spaces will be removed.


Yes, there is trim the value in location variable.

sorry, I am helpless as it is working on my machine properly

as of now i can’t i am in office

@samsseq.xaml (6.3 KB)
Check this it will work

1 Like

thankx @Manjuts90

can you pleae try out this:-

@sams In that file some activities are missing bro.