anyone know?
Printable View
anyone know?
There are a few methods to do this. Do a 'search' using unique array as the keywords.
cant seem to find it anywhere
Your array would need to be sorted, then before attempting to add a new item, do a binary search of the array. If the item is not found, add it to the array and re-sort the array ready for the next item.
A bit of mucking round, but it's the only way I know how to do it, and if you pick the right sorting algorithm there's not too much overhead. Of course it depends on the type and volume of data you're storing.
There were like 140 hits, some of them demonstrated ways to loadQuote:
Originally posted by VaxoP
cant seem to find it anywhere
an Array with unique numbers - for example.
but none with strnigs :(
Could you not just loop thru the Array to check that the item does/dosn't exist?
In any event, please be more specific as to what you want/need to acheive :)
Does the Array already exist with (string) data, and you want to add if not present?
Do you want to create a dynamic array of unique (string) data?
etc....
Bruce.
the easiest way would be to replace the array with a collection. you can't have duplicate keys in a collection.
how can you set it as a collection, and how can you work with it?
simple
VB Code:
'to create the collection dim col as collection set col = new collection 'for adding items col.add item, key 'for retreiving items col.item(key) or col(key) 'for removing items col.remove key 'to retrieve the count col.count 'to clear the collection set col = new collection 'to release the memory held by the collection set col = nothing