[Gambas-user] I need a hint on how to delete duplicate
herberth guzman
herberthguzman at ...626...
Mon Aug 28 22:22:11 CEST 2017
> Thank you all for helping me.
> Solve my problem, now it works fine. I show the code how it works.
>
> Dim sResult_Theme As String
> Dim sA As String
> Dim i, e As Integer
> Dim ssA As String[]
> Dim ssB As String[]
> Dim ssC As New String[]
> Dim sListUser As String
> Dim sListShare As String
>
> ssA = New String[]
> For Each sDir In Dir("/usr/share/themes", Null, gb.Directory)
> ssA.Add(sDir)
> Next
>
> ssB = New String[]
> For Each sListUser In Dir( Desktop.DataDir &/ "themes/", Null,
> gb.Directory)
> ssB.Add(sListUser)
> Next
>
> For e = ssA.Max To 0 Step -1
> sA = ssA[e]
> For i = ssB.Max To 0 Step -1
> If sA = ssB[i] Then
> ssA.Remove(e)
> ssB.Remove(i)
> ssC.Push(sA)
> Break
> Endif
> Next
> Next
> ssC.Insert(ssA)
> ssC.Insert(ssB)
> ssC.Sort()
>
> For Each sA In ssC.Sort(gb.Ascent)
> Print sA
> Next
>
>
> Regards
>
>Isn't that faster?
> Dim cThemes As New Collection
> Dim sTheme As String
> Dim sDir As String
> For Each sDir In Dir("/usr/share/themes", Null, gb.Directory)
> cThemes[sDir] = True
> Next
> For Each sDir In Dir(Desktop.DataDir &/ "themes/", Null, gb.Directory)
> cThemes[sDir] = True
> Next
> For Each cThemes
> aThemes.Add(cThemes.Key)
> Next
> aThemes.Sort(gb.Ascent)
> For Each sTheme In aThemes
> Print aThemes
> Next
> --
> Beno?t Minisini
Thanks Benoit, your code work for me.
Regards
More information about the User
mailing list