Compare Text Strings

Two text strings are considered equal if the strings have the same number of characters and every character in one string is identical to the corresponding character in the other string. If there is a difference between the strings, then the first character where there is a difference determines which string is greater.

For example, the string "Armor" is less than the string "Art". This is because the first difference is in the third character and the ASCII code for an m is less than the code for a t. This is consistent with rules for alphabetizing words. If you were to alphabetize these words, Armor would come before Art.

String comparisons are case-sensitive; "Art" and "art" are not equal. In fact, "Art" is less than "art". This is because all upper-case letters display before all lower-case letters in the ASCII table.

If you want to perform a case-insensitive comparison, use the upper primitive as follows:

upper(x)==upper(y)

See upper.

See Comparison Operators.