Performs a case-insensitive comparison of two strings. Returns:
CompareNoCase(string1, string2)
| Parameter |
Description |
|---|---|
| string1, string2 |
Strings to compare |
<!--- This example shows the use of CompareNoCase --->
<html>
<head>
<title> CompareNoCase Example </title>
</head>
<body bgcolor = silver>
<H3>CompareNoCase Example</H3>
<P>The compare function performs a <I>case-insensitive</I>
comparison of two strings.
<cfif IsDefined("FORM.string1")>
<cfset comparison = CompareNoCase(FORM.string1, FORM.string2)>
<!--- switch on the variable to give various responses --->
<cfswitch expression = #comparison#>
<cfcase value = "-1">
<H3>String 1 is less than String 2</H3>
<I>The strings are not equal</I>
</cfcase>
<cfcase value = "0">
<H3>String 1 is equal to String 2</H3>
<I>The strings are equal!</I>
</cfcase>
<cfcase value = "1">
<H3>String 1 is greater than String 2</H3>
<I>The strings are not equal</I>
</cfcase>
<CFDEFAULTCASE>
<H3>This is the default case</H3>