VariantCmp
f90VB Modules
f90VBDefs, f90VBVariants
Summary
Compares two variants.
Syntax
| integer(HRESULT_KIND) function VariantCmp | (VarLeft, VarRight, lcid, flags) |
| type(VARIANT),intent(in):: | VarLeft |
| type(VARIANT),intent(in):: | VarRight |
| integer(LCID_KIND),intent(in),optional:: | lcid |
| integer(LONG_KIND),intent(in),optional:: | flags |
Arguments
VarLeft and VarRight [Input]
Two variant values. Must be initialized variants.
lcid [Input/Optional]
A locale identifier.
flags [Input]
Flags that control the type of comparison performed. See comments for more information.
Comments
The function returns one of the following values:
| Return value: | If: | |
| 0 | The VarLeft is less than VarRight. | |
| 1 | The two variants are equal. | |
| 2 | The VarLeft is greater than VarRight. | |
| 3 | Either variant is NULL. | |
If an error occurs, the function may also return an error code as indicated in the following table:
| Return value: | Description | |
| DISP_E_BADVARTYPE | One or both of the passed variant types are not a valid type of variant. | |
| DISP_E_TYPEMISMATCH | At least one of the variants could not be coerced to the appropriate type for this operation. | |
| E_INVALIDARG | One of the arguments is invalid. | |
The function only compares the value (i.e. the value fields) of the variant types. It will compare strings, integers and floating points but not arrays or records.
Argument flags
Use this argument to indicate the type of comparison to be performed. If this parameter is not passed, the value NORM_IGNORECASE is assumed. The following table described all available values that can be assigned to this argument:
| Flag Identifier | Value | Meaning | |
| NORM_IGNORECASE | 0x00000001 | Ignore case. | |
| NORM_IGNORENONSPACE | 0x00000002 | Ignore nonspacing chars. | |
| NORM_IGNORESYMBOLS | 0x00000004 | Ignore symbols. | |
| NORM_IGNOREWIDTH | 0x00000008 | Ignore string width. | |
| NORM_IGNOREKANATYPE | 0x00000040 | Ignore Kana type. | |
| NORM_IGNOREKASHIDA | 0x00040000 | Ignore Arabic kashida characters. | |
Argument lcid
Optional Argument lcid can be used to indicate the Locale Id (LCID) of variants involved in the comparison. This value is useful when either created variant is of type VT_BSTR, VT_DATE or VT_DISPATCH. If argument lcid is not passed, the default user Locale (LOCALE_USER_DEFAULT) is used. The Locale controls details such as the format in which dates are converted to strings, the symbol used as the decimal separator, currency symbols, etc.
Related Topics
| For information about: | See: | |
| Variant logical and bitwise operations | VariantAnd, VariantOr, VariantXor, VariantNot, VariantNeg | |