I have a string[][] jaggedarray
like that
- Hello1, Hello2, Hello3
- Hello4, Hello5, Hello6
- Hello3, Hello1, Hello2
I tried going through all strings as in
foreach(var single in jaggedarray)
{
}
but I was lost due to the complexity of putting all values in an extra array and comparing each field with each field of single to make a decision.
What I did now is order every string alphabetically so
- Hello1, Hello2, Hello3
- Hello4, Hello5, Hello6
- Hello3, Hello1, Hello2
became
- Hello1, Hello2, Hello3
- Hello4, Hello5, Hello6
- Hello1, Hello2, Hello3
And then using distinct() on it.
It works that way, but I am looking for an elegant way, because now I have a lot of back and forth converting in my code.
What can a function look like that removes 1.
or 3.
as they contain the same values but in a different order?