home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / comparenocase.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.2 KB  |  48 lines

  1. <!--- This example shows the use of CompareNoCase --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>
  5. CompareNoCase Example
  6. </TITLE>
  7. </HEAD>
  8.  
  9. <BODY bgcolor=silver>
  10. <H3>CompareNoCase Example</H3>
  11.  
  12. <P>The CompareNoCase function performs a <I>case-insensitive</I>
  13. comparison of two strings.
  14.  
  15. <CFIF IsDefined("form.string1")>
  16. <CFSET comparison = Comparenocase("#form.string1#", "#form.string2#")>
  17.  
  18. <!--- switch on the variable to give various responses --->
  19. <CFSWITCH EXPRESSION=#comparison#>
  20.     <CFCASE value="-1">
  21.         <H3>String 1 is less than String 2</H3>
  22.         <I>The strings are not equal</I>
  23.     </CFCASE>
  24.     <CFCASE value="0">
  25.         <H3>String 1 is equal to String 2</H3>
  26.         <I>The strings are equal!</I>
  27.     </CFCASE>
  28.     <CFCASE value="1">
  29.         <H3>String 1 is greater than String 2</H3>
  30.         <I>The strings are not equal</I>
  31.     </CFCASE>
  32.     <CFDEFAULTCASE>
  33.         <H3>This is the default case</H3>
  34.     </CFDEFAULTCASE>
  35. </CFSWITCH>
  36. </CFIF>
  37.  
  38. <FORM ACTION="comparenocase.cfm" METHOD="POST">
  39. <P>String 1
  40. <BR><INPUT TYPE="Text" NAME="string1">
  41. <P>String 2
  42. <BR><INPUT TYPE="Text" NAME="string2">
  43. <P><INPUT TYPE="Submit" VALUE="Compare these Strings" NAME=""> <INPUT TYPE="RESET">
  44. </FORM>
  45.  
  46. </BODY>
  47. </HTML>       
  48.