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” ?
Assign:
arrWeak | String Array = str_Weaknesses.Split(“,”).Select(Function (x) x.Trim).toArray
Assign:
arrResist | String Array = str_Ressistence.Split(“,”).Select(Function (x) x.Trim).toArray
Assign
arrUncommons | String Array = arrWeak.Except(arrResist).toArray
Assign
str_UnCommons = String.Join(", ", arrUncommons )
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.
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
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.