CASING |
|
|
The CASING statement enables or disables case sensitivity for string comparisons.
Format
CASING OFF CASING ON CASING expr
where
By default, string comparisons in QMBasic programs are case sensitive, equivalent to use of CASING ON. Case sensitivity can be selected by use of the NOCASE.STRINGS setting of the $MODE compiler directive.
The CASING statement allows a program to dynamically enable or disable case sensitivity at run time. Use of the ON qualifier or an expr that evaluates to True enables case sensitivity. Use of the OFF qualifier or an expr that evaluates to False disables case sensitivity. Note that unlike the equivalent Basic operation in some other multivalue products, the setting only affects the program in which the CASING statement is used and is not inherited by subroutines called from that program.
A program can determine whether case sensitivity is enabled by use of the SYSTEM() function with key 1086 (SYS$CASING).
Example
CASING ON IF 'ABC' = 'abc' THEN DISPLAY 'Strings match' ELSE DISPLAY 'No match' CASING OFF IF 'ABC' = 'abc' THEN DISPLAY 'Strings match' ELSE DISPLAY 'No match'
This program fragment displays "No match" for the first test and "Strings match" for the second. |