String Variable comparison

Hi I am doing a fun project regarding Pokemon,
I am trying to compare the Weaknesses and Resistances for a list of Pokemon, how would I compare str_Weaknesses and str_Resistances and eliminate the matching words? So str_Weaknesses should be left with “Ground, Psychic, Water, Ground, Steel” ?

arrWeak | String Array = str_Weaknesses.Split(“,”).Select(Function (x) x.Trim).toArray

arrResist | String Array = str_Ressistence.Split(“,”).Select(Function (x) x.Trim).toArray

arrUncommons | String Array = arrWeak.Except(arrResist).toArray

str_UnCommons = String.Join(", ", arrUncommons )

1 Like

@Karan_Chauhan ,
You can refer the below workflow (1.4 KB)


Hi @Karan_Chauhan

Use the split function to split the words with comma(,) then store it in a array variable.
Same for the Str_Weakness and Str_Resistances. Then there is two array variables like arr1 and arr2.
Use the for each loop to iterate the arr1 and in for each loop take one more for each loop to iterate arr2. Take an if condition and compare the two.

In the last assign give like this to remove matches items

Arr1 = Arr1.Where(Function(x) x <> Foreach2).ToArray()

Hope it helps!!

Hey that didn’t work for me the arr1 just stayed the same.

For me it was changing @Karan_Chauhan. Send me the workflow of yours I’ll check.

Hey it has come up with all these errors

The errors are all:
‘ToArray’ is not a member of ‘String’

I think in Weakness array and Resistance array you are not changes the Datatype to Array. @Karan_Chauhan

I am using a lookup file and input file so I’ll send that here too
Pkmn 22-06-2023 04-28.xlsx (70.2 KB)
Lookup File.xlsx (9.5 KB)
BestCPCounters.xaml (45.8 KB)
I named the sequence Mahesh to make it easier for you to find where the activities are.

That sorted it thanks :slight_smile:

@Karan_Chauhan ,
You have to assign it to the “Array Of String” type variable not String.


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