Previous Topic

Next Topic

Option Compare statement

This statement allows control over how comparisons are performed.

Syntax

Option Compare {Binary | Text | Database }

Option

Description

Binary

Default comparison. Binary results in string comparisons based on a sort order derived from the internal binary representations of the characters. In Microsoft Windows, sort order is determined by the code page. A typical binary sort order is shown in the following example:

A < B < E < Z < a < b < e < z < À < Ê < Ø < à < ê < ø

Text

Text results in string comparisons based on a case-insensitive text sort order determined by your system's locale. When the same characters are sorted using Option Compare Text, the following text sort order is produced:

(A=a) < ( À=à) < (B=b) < (E=e) < (Ê=ê) < (Z=z) < (Ø=ø)

Database

Database results in comparisons like those using Option Compare Text, but with Null values converted to appropriate default values. Specifically null values are compared to strings as if they were the empty string "", numbers as if they were 0, booleans as if they were False, and dates as if they were #31/12/1899#.

The default value for comparisons is Binary except in filters where it is to set to Database.

See Also

MaxBasic Statements

Book Contents

Book Index