StrComp$ Function
Syntax
StrComp(Str1, Str2, Comp)
Group
String
Description
Compare two strings.
Parameters
|
Description
|
Str1
|
Compare this string with Str2.
If this value is Null then Null
is returned.
|
Str2
|
Compare this string with Str1.
If this value is Null then Null
is returned.
|
Comp
|
This numeric value indicates the type of comparison.
See Comp table below.
|
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$( )
Sub Main
Debug.Print StrComp("F","e") ' -1
Debug.Print StrComp("F","e",1) ' 1
Debug.Print StrComp("F","f",1) ' 0
End Sub