TEXT EDITING FUNCTIONS

Compares two strings.

Returns 0 if they are equal

Returns -1 if text1 precedes text2 in alphanumeric order

Returns +1 if text1 comes after text2 in alphanumeric order.

The alphabetical order is case sensitive: a comes before A.

Syntax

COMPARE (“text1”, “text2”)

Note: The required separator (comma or semi-colon) automatically corresponds to your computer’s location settings.

Data Types of the Arguments

String

Data Type of the Result

Integer

Example

Suppose that an element’s FireRating property can have a value from A through F.

If FireRating is A, B or C: it is standard-compliant.

If FireRating is D, E, or F: it is non-compliant.

In this expression, use COMPARE to compare the element’s FireRating category to “C”.

In addition, use an IF function to return one of two strings based on the result of the COMPARE function.

Expression

IF (COMPARE (FireRating, “C”) < 1, “Standard-compliant”, “Non-Compliant”)

If the result is 0, this means that FireRating equals C. This is standard-compliant.

If the result is -1, this means that FireRating comes before C alphabetically: it is either A or B. This is also standard-compliant.

If the result is 1, this means that FireRating comes after C alphabetically: it is either D, E or F. This is non-compliant.

Result

“Standard-compliant” for values of 0 or -1, otherwise “Non-compliant”