Returns a Variant (Integer) indicating the result of a string comparison.
Syntax
StrComp(string1, string2[, compare])
The StrComp function syntax has these named arguments:
Part | Description |
---|---|
string1 | Required. Any valid String expression. |
string2 | Required. Any valid String expression. |
compare | Optional. Specifies the type of string comparison. The compare argument can be omitted, or it can be 0 or 1. Specify 0 (default) to perform a binary comparison. Specify 1 to perform a textual comparison. If compare is Null, an error occurs. If compare is omitted, the comparison method is binary. |
Return Values
If | StrComp returns |
---|---|
string1 is less than string2 | -1 |
string1 is equal to string2 | 0 |
string1 is greater than string2 | 1 |
string1 or string2 is Null | Null |