The usage of the VBS property CompareMode
This article mainly explains "the usage of VBS attribute CompareMode". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the usage of VBS attribute CompareMode".
Sets and returns the comparison mode for comparing string keywords in a Dictionary object.
Object.CompareMode [= compare]
Parameter object
Required. The name of the Dictionary object.
Compare
Optional. If this parameter is provided, the compare parameter is a numeric value that represents the comparison mode used by functions such as StrComp.
Set up
The compare parameter is set as follows:
ConstantValueDescriptionvbBinaryCompare0 performs binary comparisons. VbTextCompare1 performs text comparisons. Description
Values greater than 2 can be used to compare using the locale Ids (LCID) an error occurs if you try to change the comparison mode of an Dictionary object that already contains data.
The CompareMode property uses the same value as the compare parameter in the StrComp function.
The following example illustrates how to use the CompareMode property:
Dim d Set d = CreateObject ("Scripting.Dictionary") d.CompareMode = vbTextCompared.Add "a", "Athens" 'add some keys and items. D.Add "b", "Belgrade" d.Add "c", "Cairo" d.Add "B", "Baltimore" 'failed to add method on this line because the letter b already exists in Dictionary. Thank you for your reading, the above is the content of "the usage of VBS attribute CompareMode". After the study of this article, I believe you have a deeper understanding of the usage of VBS attribute CompareMode, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!