[Gambas-user] I need a hint on how to delete duplicate items in a array
Gianluigi
bagonergi at ...626...
Fri Aug 25 13:56:24 CEST 2017
Of course, speaking of directories, I thought it was correct not to take
into account Tobias's admonitions [0].
I hope I will not go wrong :-/
Regards
Gianluigi
[0] https://sourceforge.net/p/gambas/mailman/message/35921360/
2017-08-25 9:47 GMT+02:00 Gianluigi <bagonergi at ...626...>:
> This code suggested by Vuott of Gambas-it.org, it only uses the two arrays.
> http://www.gambas-it.org/smf/index.php?topic=5876.msg42088#msg42088
>
> Regards
> Gianluigi
>
> 2017-08-25 0:58 GMT+02:00 PICCORO McKAY Lenz <mckaygerhard at ...626...>:
>
>> thanks gianluigi.. i'm search for same function..
>>
>> Lenz McKAY Gerardo (PICCORO)
>> http://qgqlochekone.blogspot.com
>>
>> 2017-08-24 18:04 GMT-04:00 Gianluigi <bagonergi at ...626...>:
>>
>> > I don't know if this can help you.
>> > https://gambas-playground.proko.eu/?gist=c6e63a84d209911a2b3
>> ff50d2b46a368
>> > Regards
>> > Gianluigi
>> >
>> > 2017-08-24 22:39 GMT+02:00 herberth guzman <herberthguzman at ...626...>:
>> >
>> > > Hi Benoit, how are you..?
>> > >
>> > > I have a question, I'm lost
>> > > Lol
>> > >
>> > > I need a hint on how to delete duplicate items in a array
>> > >
>> > > I have the following function (I send you the code)
>> > > And if he works
>> > >
>> > >
>> > > Example
>> > >
>> > > For Each sDir In ["/usr/share/themes/", Desktop.DataDir &/ "themes/"]
>> > > For Each sNames In RDir(sDir, "*", gb.Directory)
>> > >
>> > > Print sNames
>> > >
>> > > Next
>> > > Next
>> > >
>> > >
>> > > The problem is the following:
>> > >
>> > > I have /usr/share/themes/Ambiance
>> > > I have /home/herberth.local/share/themes/Ambiance
>> > >
>> > > And I only need one Ambiance
>> > > And not two Ambiance
>> > >
>> > > Please help me solve my problem, I have two days and I can not. I
>> want to
>> > > cry.
>> > > Lol
>> > >
>> > >
>> > > Attachme my complete code
>> > >
>> > >
>> > >
>> > >
>> > > Private Function ReturnArrays(SortedArray As String[], withNumber As
>> > > Boolean) As String[]
>> > >
>> > > Dim sSingle, sWithNumber As New String[]
>> > > Dim i, n As Integer
>> > >
>> > > For i = 0 To SortedArray.Max
>> > > ' You can avoid with Tobias's trick (For i = 1 To ...)
>> > > If i < SortedArray.Max Then
>> > > If SortedArray[i] = SortedArray[i + 1] Then
>> > > Inc n
>> > > Else
>> > > Inc n
>> > > sSingle.Push(SortedArray[i])
>> > > sWithNumber.Push(n & SortedArray[i])
>> > > n = 0
>> > > Endif
>> > > Endif
>> > > Next
>> > > Inc n
>> > > sSingle.Push(SortedArray[SortedArray.Max])
>> > > sWithNumber.Push(n & SortedArray[SortedArray.Max])
>> > > If withNumber Then
>> > > Return sWithNumber
>> > > Else
>> > > Return sSingle
>> > > Endif
>> > >
>> > > End
>> > >
>> > > Public Sub sListTheme()
>> > >
>> > > Dim sDir As String
>> > > Dim sFiles As String
>> > > Dim sSort As String[]
>> > > Dim s As String
>> > >
>> > >
>> > > For Each sDir In ["/usr/share/themes/", Desktop.DataDir &/
>> "themes/"]
>> > >
>> > > For Each sFiles In Dir(sDir, "*", gb.Directory).Sort()
>> > > sSort = [sFiles]
>> > >
>> > > For Each s In ReturnArrays(sSort, 0)
>> > > Print s
>> > > Next
>> > >
>> > > Next
>> > > Next
>> > >
>> > > End
>> > >
>> > >
>> > > If you can help me I'll thank you.
>> > > Thank you.
>> > > Regards
>> > > ------------------------------------------------------------
>> > > ------------------
>> > > 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 at 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 at 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 at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
>
More information about the User
mailing list