[Gambas-user] Make an array having only unique entries

Ron ron at ...1740...
Sat Mar 22 22:38:37 CET 2008


Stephen Bungay schreef:
>    Push the array (or result, or whatever) to a collection and use the 
> category as the index into it. If you try to add an index twice it will 
> throw an error, at which time you keep on processing, proceeding to the 
> next item. Now you have a unique collection of items, you don't need to 
> use an array, but if you want to just push the collection back to the 
> array. Two step process, no fuss, no muss.
>
>   

Yes that works great!

PUBLIC cPhotoCatList AS Collection
PUBLIC sPhotoCatLst AS String
...
cPhotoCatList = NEW Collection

TRY cPhotoCatList.Add(sTempCategory, sTempCategory)
...
' list unique categories
    FOR EACH sPhotoCatLst IN cPhotoCatList
       PRINT sPhotoCatLst
    NEXT

Domotics Public Misc Uncategorized

Thanks!
Ron.




More information about the User mailing list