Xbasic

== (Exactly Matching Operator)

Syntax

Result as L = Operand1 as A == Operand2 as A

Arguments

Operand1Any Type

A value or expression of any type.

Operand2Any Type

A value or expression of any type.

Returns

ResultLogical

Returns .t., Operand1 and Operand2 are equal, otherwise .f.

Description

The Exactly Matching operator returns .T. (TRUE) if the expressions on both sides of the operator are the same type and are equal.

Discussion

The Exactly Matching operator does not automatically remove trailing blanks. The two strings must match exactly, character for character, by case and by length (including blank spaces).

The opposite of "==" is "!=" ( Not Exactly Matching Operator ).

When comparing a character field to a string, remember that the length of the field is pre-defined. If the field is assigned fewer characters than its defined length, the remainder of the field is padded with spaces.

Examples:

Since the number of trailing blanks are different

? "Foley" == "Foley    "
= .F.

Since the case is different

? "Foley" == "foley"
= .F.

See Also