[Gambas-user] Get distinct array from large array
Jussi Lahtinen
jussi.lahtinen at gmail.com
Fri Dec 10 05:02:57 CET 2021
yyy = xxx.Copy()
Jussi
On Fri, Dec 10, 2021 at 5:54 AM Safiur Rahman <isafiur at gmail.com> wrote:
> 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
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20211210/c96077f5/attachment.htm>
More information about the User
mailing list