My two cents. Public Sub Main()
Dim sSort As String[] = ["A", "B", "B", "B", "C", "D", "D", "E", "E", "E", "E", "F"] Dim sSame As String[] = sSort Dim bb As New Byte[] Dim sSingle As New String[] Dim i, n As Integer For i = 0 To sSort.Max If i < sSort.Max Then If sSort[i] = sSame[i + 1] Then Inc n Else sSingle.Push(sSort[i]) bb.Push(n + 1) n = 0 Endif Endif Next sSingle.Push(sSort[sSort.Max]) bb.Push(n + 1) For i = 0 To sSingle.Max Print sSingle[i] Next For i = 0 To bb.Max Print bb[i] & sSingle[i] Next End Regards Gianluigi 2017-06-27 16:33 GMT+02:00 <nand...@nothingsimple.com>: > Another very effective and simple would be: > > You have your array with data > You create a new empty array. > > Loop through each item in your array with data > If it's not in the new array, then add it. > > Destroy the original array. > Keep the new one. > ...something like (syntax may not be correct) > > Public Function RemoveMultiple(a As String[]) As String[] > > Dim x as Integer > Dim z as NEW STRING[] > > For x = 1 to a.count() > if z.Find(a) = 0 Then z.Add(a[x]) > Next > > Return z > > END > > -Nando (Canada) > > > > > -- > Open WebMail Project (http://openwebmail.org) > > > ---------- Original Message ----------- > From: Hans Lehmann <h...@gambas-buch.de> > To: gambas-user@lists.sourceforge.net > Sent: Tue, 27 Jun 2017 15:51:19 +0200 > Subject: Re: [Gambas-user] I need a hint on how to deleted duplicate items > in a array > > > 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 > > > > ------------------------------------------------------------ > ------------------ > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > _______________________________________________ > > Gambas-user mailing list > > Gambas-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------- End of Original Message ------- > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user