Small company logo:
   History
 
Advertising banner:
 
 StrComp
Home • Help • Customization Tools • FCAS • Language Reference • StrComp
 
Purpose
Compares two string expressions.
Syntax
StrComp (String1, String2 [, Case])


Case
Determines the case sensitivity of the comparison.
If Case is 0, the comparison is case sensitive ("a" <> "A").
If Case is 1, the comparison is case insensitive ("a" = "A").
If the Case argument is omitted, the default behavior is case-sensitive comparisons ("a" <> "A").

StrComp returns the following integer values based on the comparison evaluation:


Value
Comparison result
-1
String1 < String2
0
String1 = String2
1
String1 > String2

Example
Sub Main()
        Dim s As String
        s = "aaa"
        Select Case StrComp(s, "bbb")
        Case -1
                Print "Source string is less than comparison string."
        ...
        End Select
End Sub