The compare() function is used to compare two strings, and to decide whether they are equal, or if not, which one sorts before the other.
For example, under most collations «compare("ALPHA", "BETA") » returns -1 .
Argument | Data Type | Meaning |
---|---|---|
value-1 | xs:string? | The first string to be compared |
value-2 | xs:string? | The second string to be compared |
collation (optional) | xs:string | The collation to be used to perform the comparison |
Result | xs:integer? | -1 if value-1 is less than value-2 , zero if they are equal, +1 if value-1 is greater than value-2 |