<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.compare.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.compare</api:function-name><api:suggest>fn.compare</api:suggest><api:suggest>fn</api:suggest><api:suggest>compare</api:suggest><api:function-link mode="xquery" fullname="fn:compare">/apidoc/8.0/fn:compare.xml</api:function-link><api:function mode="javascript" name="compare" type="builtin" lib="fn" category="StringBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.compare"><api:summary>
<p xmlns="http://www.w3.org/1999/xhtml">
  Returns -1, 0, or 1, depending on whether the value of the $comparand1 
  is respectively less than, equal to, or greater than the value of 
  $comparand2, according to the rules of the collation that is used.
</p>
</api:summary><api:params><api:param name="comparand1" type="xs:string?"><api:param-description>
  A string to be compared.
  </api:param-description><api:param-name>comparand1</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="comparand2" type="xs:string?"><api:param-description>
  A string to be compared.
  </api:param-description><api:param-name>comparand2</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="collation" type="xs:string" optional="true"><api:param-description>
  The optional name of a valid collation URI.  For information on the
  collation URI syntax, see the <em xmlns="http://www.w3.org/1999/xhtml">Search Developer's Guide</em>.
  </api:param-description><api:param-name>collation</api:param-name><api:param-type>String</api:param-type></api:param></api:params><api:return>Number?</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn.compare("hello", "goodbye")

=&gt; 1
</pre>
</api:example></api:function></api:function-page>