Dictionary
Construction:
dictionary = new ActiveXObject("Scripting.Dictionary");
Methods
Add
Adds a key and item pair to a Dictionary object. An error occurs if the key already exists.
dictionary.Add(key, item)
Exists
Returns true if a specified key exists in the Dictionary object, false if it does not.
dictionary.Exists(key)
Items
Returns an array containing all the items in a Dictionary object.
items=(new VBArray(dictionary.Items())).toArray();
Keys
Returns an array containing all existing keys in a Dictionary object.
keys=(new VBArray(dictionary.Keys())).toArray();
Remove
Removes a key, item pair from a Dictionary object. An error occurs if the specified key, item pair does not exist.
dictionary.Remove(key)
RemoveAll
Removes all key, item pairs from a Dictionary object.
dictionary.RemoveAll()
Properties
Count Property
Returns the number of items in a collection or Dictionary object. Read-only.
object.Count
Item Property
Sets or returns an item for a specified key in a Dictionary object. For collections, returns an item based on the specified key. Read/write.
If key is not found when changing an item, a new key is created with the specified newitem. If key is not found when attempting to return an existing item, a new key is created and its corresponding item is left empty.
object.Item(key)[ = newitem]
Key Property
Sets a key in a Dictionary object. If key is not found when changing a key, a new key is created and its associated item is left empty.
object.Key(key) = newkey
CompareMode Property
Sets and returns the comparison mode for comparing string keys in a Dictionary object.
compare is a value representing the comparison mode. Acceptable values are 0 (Binary), 1 (Text), 2 (Database). Values greater than 2 can be used to refer to comparisons using specific Locale IDs (LCID).
An error occurs if you try to change the comparison mode of a Dictionary object that already contains data.
dictionary.CompareMode[=compare]