In OmniMark, it is possible to use a lexical comparison to compare two or more string values. In such a comparison, the string values are compared character by character. Corresponding characters of the two strings are compared; the first characters that differ determine the result of the comparison.
Character comparisons are based on the numeric value of the character. For instance, the space (ASCII 32) sorts before the letter "a" (ASCII 65) on systems that use the ASCII representation of characters. (On EBCDIC systems, the EBCDIC values would be used.) The following string comparison operators are available:
If all of the characters up to the end of at least one of the strings are the same, the shorter string is considered to be less than the longer one. Thus, "aa" is less than "aaa".
You can use consecutive comparisons to perform a range check:
process local stream x initial {"P"} output "OK" when "M" < x < "R"The expression
"M" < x < "R"
is evaluated as it it were written "M" < x & x < "R"
.
If the ul
option is used, then, for the purpose of the comparison, every letter with both an uppercase and lowercase value is mapped to the lower value. For example, on ASCII systems, the letter "A" (ASCII 65) is less than "B" (ASCII 66), but "a" (ASCII 97) is greater than "B".
The declare data-letters
declaration can be used to specify uppercase/lowercase relationships for other characters, such as accented characters.