Siebel VB Language Reference > VB Language Reference >

Option Compare Statement

This standard VB statement specifies the default method for string comparisons: either case-sensitive or case-insensitive.


Option Compare {Binary | Text}


Not applicable



Not applicable


The Option Compare statement must be placed in the (general) (declarations) section in the Siebel VB Editor, as shown in Option Base Statement.

Binary comparisons are case-sensitive (that is, lowercase and uppercase letters are different). Text comparisons are not case-sensitive.

Binary comparisons compare strings based upon the ANSI character set. Text comparisons are based upon the relative order of characters as determined by the country code setting for your computer.


This example compares two strings: Jane Smith and jane smith. When Option Compare is Text, the strings are considered the same. If Option Compare is Binary, they are not the same. Binary is the default. To see the difference, run the example, and then comment out the Option Compare statement and run it again.

Option Compare Text
Sub Button_Click
   Dim strg1 as String
   Dim strg2 as String
   Dim retvalue as Integer
   strg1 = "JANE SMITH"
   strg2 = "jane smith"
   retvalue = StrComp(strg1,strg2)
   If retvalue = 0 then
      'The strings are identical
      'The strings are not identical
      Exit Sub
      End If
End Sub

See Also

InStr Function
StrComp Function

Siebel VB Language Reference