
MarkLogic 9 Product Documentation
fn.comparefn.compare(
   comparand1 as String?,
   comparand2 as String?,
   [collation as String]
) as Number?
Summary
  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.
	  
	  
	
	  
	    | Parameters | 
	  
	
	  
	    | comparand1 | 
	    
  A string to be compared.
   | 
	  
	  
	    | comparand2 | 
	    
  A string to be compared.
   | 
	  
	  
	    | collation | 
	    
  The optional name of a valid collation URI.  For information on the
  collation URI syntax, see the Search Developer's Guide.
   | 
	  
	
Example
fn.compare("hello", "goodbye")
=> 1
    Copyright © 2025 MarkLogic Corporation. MARKLOGIC is a
    registered trademark of MarkLogic Corporation.