compare
The compare function takes two strings as arguments and compares them for equality and alphabetically. If string1 is alphabetically less than string2 (for example the two string are "A" and "B"), then the function returns -1. If the two strings are equal (for example, "A" and "A"), the function returns 0. If string1 is greater than string2 (for example, "B" and "A"), then the function returns 1.
This variant of the function uses the default collation, which is Unicode. Another variant of this function exists where you can supply the collation as argument.
Languages
XQuery, XSLT 2.0, XSLT 3.0.
Parameters
Name | Type | Description |
---|---|---|
string1 | xs:string | The first input string. |
string2 | xs:string | The second input string. |