Tamino XML Server Version 9.7
 —  XQuery 4 Reference Guide  —

fn:compare

Compare two strings.


Syntax

fn:compare(string $string1, string? $string2) => integer
fn:compare(string $string1, string? $string2, string $collation) => integer

Top of page

Description

This function compares two strings. If a third parameter is supplied, the strings are compared according to the specified collation. If the third parameter is not supplied, the strings are compared according to the default collation. It returns one of the following integer values:

-1 the value of $string1 is less than that of $string2
0 the value of $string1 is equal to that of $string2
1 the value of $string1 is greater than that of $string2

If no collation is used, Unicode code points are used when comparing.

Top of page

Arguments

$string1

string value

$string2

string value

$collation

string value $string

Top of page

Examples

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:

Top of page