Dictionary Object
Dictionary Object that stores data key, item pairs.
A Dictionary object is the equivalent of a PERL associative array/Hash Variable. Items can be any form of data, and are stored in the array. Each item is associated with a unique key. The key is used to retrieve an individual item and is usually an integer or a string, but can be anything except an array.
Creating a Dictionary Object:
Set objDictionary = CreateObject("Scripting.Dictionary")
Dictionary Objects Methods:
Add Method
Adds a key and item pair to a Dictionary object
Exists Method
Returns true if a specified key exists in the Dictionary object, false if it does not.
Items Method
Returns an array containing all the items in a Dictionary object.
Keys Method
Returns an array containing all existing keys in a Dictionary object.
Remove Method
Removes a key, item pair from a Dictionary object.
RemoveAll Method
The RemoveAll method removes all key, item pairs from a Dictionary object.
Example:
Dim cities
Set cities = CreateObject("Scripting.Dictionary")
cities.Add "h", "Hyderabad"
cities.Add "b", "Bangalore"
cities.Add "c", "Chennai"
Dictionary Objects Properties:
Count Property
Returns the number of items in a collection or Dictionary object. Read-only.
CompareMode Property
Sets and returns the comparison mode for comparing string keys in a Dictionary object.
Key Property
Sets a key in a Dictionary object.
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.