Syntax |
Option Compare [Binary | Text] |
Description |
Controls how strings are compared. |
Comments |
When Option Compare is set to Binary, then string comparisons are case-sensitive (for example, "A" does not equal "a"). When it is set to Text, string comparisons are case-insensitive (for example, "A" is equal to "a"). The default value for Option Compare is Binary. The Option Compare statement affects all string comparisons in any statements that follow the Option Compare statement. Additionally, the setting affects the default behavior of Instr, StrComp, and the Like operator. The following table shows the types of string comparisons affected by this setting: > < <> The Option Compare statement must appear outside the scope of all subroutines and functions. In other words, it cannot appear within a Sub or Function block. |
Example |
This example shows the use of Option Compare. Option Compare Binary Option Compare Text Sub Main() |
See Also |
Like (operator); InStr (function); StrComp (function); Comparison Operators (topic). |
O |