Version: 2.0
The CompareMode property is used to set and return the key's string comparison mode which determines how keys are matched while looking up or searching. Syntax: object. Count Property Syntax: object.
Keys can be treated as case-sensitive or case-insensitive.
To do the comparison, you use the Comparison Constants. You may use
either the CONSTANT (left column) or the VALUE (center column) in your
code and get the same results.
Comparison Constants
CONSTANT | VALUE | DESCRIPTION |
---|---|---|
VBBinaryCompare | 0 | Binary Comparison |
VBTextCompare | 1 | Text Comparison |
VBDataBaseCompare | 2 | Compare information inside database |
<%
Dim d
Set d = CreateObject("Scripting.Dictionary")
d.CompareMode = VBTextCompare
d.Add "a", "Alvis"
d.Add "b", "Buick"
d.Add "c", "Cadillac"
d.Add "B", "Bentley" 'fails here.
%>
"Alvis"
"Buick"
"Cadillac"
In this example the Add method fails on the last line because the key "b" already exists. If CompareMode were set to VBBinaryCompare a new key "B" (upper case) with a value of "Bentley" will be added to the dictionary.