<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>COMPARE</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">COMPARE</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Performs a case-sensitive comparison of two strings. 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Returns</span><ul>

<li>-1, if string1 is less than string2</li>

<li>0, if string1 is equal to string2</li>

<li>1, if string1 is greater than string2</li>
</ul>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Category</span>
<p>
String functions
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Function syntax</span><pre>Compare(string1, string2)
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
CompareNoCase, Find
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Parameters</span>
<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Usage</span>
<p>
Compares the values of corresponding characters in string1 and string2.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span><pre>&lt;h3&gt;Compare Example&lt;/h3&gt;
&lt;p&gt;The compare function performs a &lt;I&gt;case-sensitive&lt;/I&gt; comparison of two 
strings.

&lt;cfif IsDefined(&quot;FORM.string1&quot;)&gt;
 &lt;cfset comparison = Compare(FORM.string1, FORM.string2)&gt;
 &lt;!--- switch on the variable to give various responses ---&gt;
 &lt;cfswitch expression = #comparison#&gt;
   &lt;cfcase value = &quot;-1&quot;&gt;
      &lt;h3&gt;String 1 is less than String 2&lt;/h3&gt;
      &lt;I&gt;The strings are not equal&lt;/I&gt;
   &lt;/cfcase&gt;
   &lt;cfcase value = &quot;0&quot;&gt;
      &lt;h3&gt;String 1 is equal to String 2&lt;/h3&gt;
      &lt;I&gt;The strings are equal!&lt;/I&gt;
   &lt;/cfcase&gt;
   &lt;cfcase value = &quot;1&quot;&gt;
      &lt;h3&gt;String 1 is greater than String 2&lt;/h3&gt;
      &lt;I&gt;The strings are not equal&lt;/I&gt;
   &lt;/cfcase&gt;
   &lt;CFDEFAULTCASE&gt;
      &lt;h3&gt;This is the default case&lt;/h3&gt;
   &lt;/CFDEFAULTCASE&gt;
   &lt;/cfswitch&gt;
&lt;/cfif&gt;
&lt;form action = &quot;compare.cfm&quot; method=&quot;post&quot;&gt;
&lt;p&gt;String 1
&lt;br&gt;&lt;input type = &quot;Text&quot; name = &quot;string1&quot;&gt;
&lt;p&gt;String 2
&lt;br&gt;&lt;input type = &quot;Text&quot; name = &quot;string2&quot;&gt;
&lt;p&gt;&lt;input type = &quot;Submit&quot; value = &quot;Compare these Strings&quot; name = &quot;&quot;&gt;
   &lt;input type = &quot;RESET&quot;&gt;
&lt;/form&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="STRING1">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">STRING1</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>A string or a variable that contains one </p>

  </td>
  </tr>
  </table>
</div>
<div id="STRING2">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">STRING2</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>A string or a variable that contains one </p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
