[Gambas-user] Get distinct array from large array
Safiur Rahman
isafiur at gmail.com
Fri Dec 10 04:53:38 CET 2021
Hi
I want to get a string array of distinct items from another string array
which has large count (about a million). I hope Benoît will add a function
for this. Till then what can be the fastest way to get array of distinct
items?
I am using following code to achieve that. But it is slow
Dim yyy As String[]
Dim xx As String
yyy = New String[]
For Each xx In xxx
If yyy.Count = 0 Then
yyy.Add(xx)
Else If yyy.Count > 0 Then
If yyy.Find(xx, gb.Binary) = -1 Then
yyy.Add(xx)
Endif
Endif
Next
--
Regards
Safiur Rahman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20211210/789da379/attachment.htm>
More information about the User
mailing list