Hello! I am new to Uipath and looking for a way to loop over string indices. I am trying to find the characters in two strings (str1, str2) that appear in the same position.
Ex: Str 1 = 1234
Str 2 = 4334
I would like to do this via below approach
for i = 0 to string.length
if Str1[i] = str2[i]
print(“Match” )
else
print(“Not match”)
Can you please let me know how can I achieve this using For each in Uipath? What should be the Type Argument?
To use a ForEach, you need to use .ToCharArray on the string, like ForEach chr1 In str1.ToCharArray
The 2018.4 version should give you the property for iteration number, which you can use in the second string. Or use a counter if not.
ForEach chr1 In str1.ToCharArray
If chr1 = str2(i)
I normally try to avoid Do While loops using counters, but that would work too if you choose.