.. _compare: ======= compare ======= Compares two strings Description ~~~~~~~~~~~ The fn:compare function returns one of the values: -1 if $comparand1 is less than $comparand2 0 if $comparand1 is equal to $comparand2 1 if $comparand1 is greater than $comparand2 A comparand is greater than the other comparand if it starts with the other comparand and has additional characters. For example, abc is greater than ab. Comparison operators (=, !=, <, <=, >, >=) can also be used to compare strings, and you may find the syntax more convenient. However, if you need to use a specific collation other than the default, you must use the fn:compare function. .. list-table:: :widths: 40 60 :header-rows: 1 * - **Parameters** - **Description** * - comparand1:string() - the first string to compare * - comparand2:string() - the second string to compare * - collation:string() - the collation to use for sorting Examples ~~~~~~~~ .. list-table:: :widths: 50 50 :header-rows: 1 * - **XPath** - **Results** * - - See Also ~~~~~~~~ .. toctree:: :titlesonly: :glob: * :ref:`codepoint-equal`.