StrComp Function |
Microsoft.VisualBasic.Strings
StrComp( string1 , string2 [, compare ])
Any string expression
Any string expression
Either CompareMethod.Binary or CompareMethod.Text
Integer
Determines whether two strings are equal and, if not, which of two strings has the greater value
The compare argument is one of CompareMethod.Binary or CompareMethod.Text . If no comparison is specified, VB uses the value of Option Compare .
The following table describes the possible return values from the StrComp function:
Scenario | Return value |
---|---|
string1 < string2 | -1 |
string1 = string2 |
|
string1 > string2 | 1 |
string1 or string2 is Null | Null |
Using the comparison operators < , <= , > , and >= to compare strings performs a character-by-character binary comparison.
The StrComp function can provide a significant performance improvement (in the neighborhood of 30% to 70%) over the comparison operators.
StrConv Function, StrDup Function, StrReverse Function