COMPARE

Syntax

COMPARE (string_expression1, string_expression2, True|False)

Description

Compares the strings and returns a positive or negative Integer32 value depending on the results.

Arguments

string_expression1 Any string expression.
string_expression2 The string expression to compare.
True|False If Boolean True, ignore the case between strings.
If Boolean False, make the compare case-sensitive.

Returns

A negative number — If string_expression1 is less than string_expression2.

0 — If string_expression1 is equal to string_expression2.

A positive number— If string_expression1 is greater than string_expression2.

Remarks

COMPARE compares the data within two strings. When comparing letters, A has the smallest value.

One or both string expressions can be null. Any string, including an empty string (""), is considered to be greater than a null. If both expressions are null, the function returns 0 (equal).

If the comparison is case-sensitive (that is, the third parameter is set to false,False, or FALSE), then every character in the string must be the same case for string_expression1 to be considered equal to string_expression2.

If the comparison is not case-sensitive (the third parameter is set to true, True, or TRUE), then TIBCO Cloud™ Integration - Connect ignores case when comparing string_expression1 and string_expression2.

Examples

COMPARE ("Smith", "Smythe", False)

Returns: -1

COMPARE ("97239", "01720", True)

Returns: 1

Related Topics

Text Functions