[Gambas-user] I need a hint on how to deleted duplicate items in a array

Hans Lehmann hans at ...3219...
Tue Jun 27 15:51:19 CEST 2017


Hello,

look here:

8<-----------------------------------------------------------------------------------------
Public Function RemoveMultiple(aStringListe As String[]) As String[]
   Dim iCount As Integer
   Dim iIndex As Integer
   Dim sElement As String

   iIndex = 0 ' Initialisierung NICHT notwendig
   While iIndex < aStringListe.Count
     iCount = 0
     sElement = aStringListe[iIndex]
     While aStringListe.Find(sElement) <> -1
       Inc iCount
       aStringListe.Remove(aStringListe.Find(sElement))
     Wend
     If iCount Mod 2 = 1 Then
        aStringListe.Add(sElement, iIndex)
        Inc iIndex
     Endif ' iCount Mod 2 = 1 ?
   Wend

   Return aStringListe

End ' RemoveMultiple(...)
8<-----------------------------------------------------------------------------------------

Hans
gambas-buch.de




More information about the User mailing list