Syntax StrComp(Str1, Str2, Comp)
Group String
Description Compare two strings.
Parameter Description
Str1 Compare this string with Str2.
Str2 Compare this string with Str1.
Comp This numeric value indicates the type of comparison. See Comp table below.
Result Description
-1 Str1 is less than Str2.
0 Str1 is equal to Str2.
1 Str1 is greater than Str2.
Comp Value Effect
vbUseCompareOption -1 Performs the comparison using the Option Compare statement value.
vbBinaryCompare 0 Compares the string's binary data.
vbTextCompare 1 Compares the string's text using the collation rules.
vbDatabaseCompare 2 Microsoft Access only. (Not supported.)
See Also LCase( ), Option Compare, StrConv( ), UCase( ).
Example '#Language
"WWB.NET"
SubMain
Debug.Print
StrComp("F","e") ' -1
Debug.Print StrComp("F","e",1)
' 1
Debug.Print
StrComp("F","f",1) ' 0
EndSub