Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference > Siebel VB Language Reference >
Option Compare Statement
This standard VB statement specifies the default method for string comparisons: either case-sensitive or case-insensitive.
Syntax
Option Compare { Binary | Text }
Returns
Not applicable
Usage
The Option Compare statement must be placed in the (general) (declarations) section in the Siebel VB Editor, as shown in Figure 1.
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.
Example
This example compares two strings:
Jane Smith
andjane 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"
i:
retvalue = StrComp(strg1,strg2)
If retvalue = 0 then
`The strings are identical
Else
`The strings are not identical
Exit Sub
End If
End SubSee Also
Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference Published: 18 June 2003 |