Command SET EXACT Foundation

Sets whether comparison of character strings will be exact.

Syntax
SET EXACT on | OFF | <lToggle>
Scope
thread-local
Parameters
<lToggle>
<lToggle> is a logical expression which must appear in parentheses. Instead of the logical expression, the option ON can be specified for the value .T. (true) or OFF for the value .F. (false). When .T. or ON is specified, the comparison of two character strings includes consideration of the length of the two strings.
Description

The command SET EXACT exists only for compatibility reasons and should no longer be used. The command SET LEXICAL is better suited when approximate comparisons are to be performed between character strings.

SET EXACT defines the rules for comparisons of two character strings using the comparison operators (=, >, <, => and =<). When SET EXACT is set to OFF, the expression cLeftString = cRightString is evaluated according to the following rules:

When cRightString contains a null string (""), the expression returns the value .T. (true).

When cRightString contains more characters than cLeftString, the expression returns the value .F. (false).

In all other cases, the expression returns the value .T. (true) if the characters in cRightString match with the characters in cLeftString up to the length of cRightString. Otherwise, .F. (false) is returned.

When SET EXACT is set to ON, comparison of two character strings with the comparison operators (=, >, <, => and =<) returns the value .T. (true), when their characters match except for any blank spaces appearing at the end.

The exact equals operator == additionally considers any blank spaces appearing at the end when comparing character strings.

The setting SET LEXICAL ON has precedence over the setting SET EXACT ON. If lexical comparison rules are defined with SetLexRule() the strings are transformed before a comparison is made according to SET EXACT.

Examples
SET EXACT
// The example shows the effect of SET EXACT on the comparison 
// of character strings using the simple comparison operator. 

PROCEDURE Main 

   SET EXACT OFF 
   ? "Abc"   = "Abcde"           // result: .F. 

   ? "Abcde" = "Abc"             // result: .T. 
   ? "Abc"   = ""                // result: .T. 

   ? ""      = "Abc"             // result: .F. 
   ? "Abc"   = "Abc  "           // result: .F. 

   SET EXACT ON 
   ? "Abc"   = "Abcde"           // result: .F. 

   ? "Abcde" = "Abc"             // result: .F. 
   ? "Abc"   = ""                // result: .F. 

   ? ""      = "Abc"             // result: .F. 
   ? "Abc"   = "Abc  "           // result: .T. 

                                 // exact equals operator 
   ? "Abc"  == "Abc  "           // result: .F. 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.