Map
The Map object is an associative container. It is similar to an array or vector (e.g. Vector) in that it can store one or more objects, but has the advantage of using a dictionary system to locate objects rather than numeric indexes. You can therefore insert or lookup objects using an arbitrary value (string, integer, date, etc.) as the key. (Note that keys are implicitly converted into strings, regardless of initial type.)
You can access elements of the map as if the map is a function (e.g. Map("foo") to reference an element by the key "foo"). You can also use square brackets (like an array or Vector) but only if the name of the key begins with an underscore, or is completely numeric (e.g. Map[123] or Map["_foo"]). Additionally you can use the get and set methods.
You can create a new Map using the DOpusFactory.Map method. The keys in a map can be enumerated, and are automatically kept sorted.
The two examples below both output the following:
JScript Example:
VBScript Example:
最后更新于