Deduplication of data from a 2D array

I want to remove the duplicate value from the 2D array.

this is sample :
string[10] { string[3] { “ABC”, “5”, “4” }, string[3] { “ABC”, “5”, “4” }, string[3] { “ABC”, “5”, “4” }, string[3] { “ABC”, “5”, “4” }, string[3] { “QWE”, “4”, “3” }, string[3] { “QWE”, “4”, “3” }, string[3] { “QWE”, “4”, “3” }, string[3] { “BNM”, “4”, “3” }, string[3] { “BNM”, “4”, “3” }, string[3] { “BNM”, “4”, “3” } }

result : {{ “ABC”, “5”, “4” }, { “QWE”, “4”, “3” }, { “BNM”, “4”, “3” }}

The variable is array in array

“variable.distinct().toarray” doesn’t work

thanks

Hi,

If there is no tab(chr(10)) in the data, the following will work, for example.

arrVar = arrVar.GroupBy(Function(a) String.Join(chr(10),a)).Select(Function(g) g.First()).ToArray

Regards,

2 Likes

Hi @hckwon5 ,

It took me a while but here is the solution →
image

arr_arrstr.GroupBy(Function(g) String.Join(",",g)).Select(Function(s) s.First).toarray()

2DArraysDuplicate.xaml (5.8 KB)
Edit: No, I didn’t copy the solution from above, Yoichi-san is just lighting fast with his solutions and we happened to have the same approach!
**Kind Regards,

Ashwin A.K**

1 Like

It’s working. Thank you!

1 Like

Thank you for your help, lol

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