I'm trying to compare 2 strings (1 from dropdown of input dialog)

Hi everyone
I’m trying to compare 2 strings
when one of them is the output of Input Dialog activity (a dropdown by string (that I seperated the options by comma in the main string)) and the other is row in DT that runs on For each row.
and now I’m trying to compare the strings and its always False
tried “.equals(var)”, tried".tostring.equals(var)", tried “.tostring.equals(var.tostring)” and also var.tostring=var2

Please help

Hi
Kindly try like this inside the for each row ACTIVITY
in a IF condition
row(“yourcolumnname”).ToString.ToUpper.Contains(yourvariable.ToString.ToUpper)

Cheers @dlichten

1 Like

still the same
and if I remember correctly the ToUpper is to make it Capital Letters (and my letters r in Hebrew - and there is no capital in Hebrew)
and also why .Contains?

please print the both comparing variable/values before comparing to verify the logic.
also use the trim function to clear the unwanted space during the comparison.

XYZ.ToLower.Trim.Equals(ABC.ToLower.Trim)

Fine
then did we try with normal contains method
row(“yourcolumnname”).ToString.Trim.Contains(yourvariable.ToString.Trim) OR yourvariable.ToString.Trim.Contains(row(“yourcolumnname”).ToString.Trim)

Cheers @dlichten

1 Like

this worked
BUT PLEASE CAN U EXPLAIN TO ME WHY IT WORKED?? AND WHAT WAS THE PROBLEM?

THANK U VERY MUCH

String.Compare(StringA, StringB, new CultureInfo(“he”), CompareOptions.None)

what is this option?
and what is the - new CultureInfo(“he”), compareoptions.none
and also thanks for your time

Hi again
Now I noticed that when Im choosing one of the first dropdown options it gives me the answer for another (that have almost the same string, for example: string1: game, string2: game end (its not really the string in the project but its kind of the same))

thank u very much

1 Like

can u help me with this?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.