Get the App
SLTechnology News&Howtos  ›  Development  › 

The usage of the VBS property CompareMode

Shulou Source: shulou.com Published: 2022-06-03 19:53:54 10月25日 Update

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!

Tags: Attributes parameters objects patterns learning content functions same binary examples keys keywords regions names letters characters strings that is ideas situations Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple NVidia Linux Docker