Whatever message this page gives is out now! Go check it out!

CompareNoCase

Last update:
May 18, 2026

Description

Performs a case-insensitive comparison of two strings.

Returns

An indicator of the difference:
  • A negative number, if string1 is less than string2
  • 0, if string1 is equal to string2
  • A positive number, if string1 is greater than string2

Category

Function syntax

CompareNoCase(string1, string2)

See also

Compare, FindNoCase; Evaluation and type conversion issues in Data type conversion in the Developing ColdFusion Applications

Parameters

Parameter
Description
string1
A string or a variable that contains one
string2
A string or a variable that contains one

Example

<cfscript>
    myString1="ColdFusion"
    myString2="Coldfusion"
    myString3="ColdFusion (2016 release)"
    myString4="ColdFusion (2018 release)"
    writeOutput(CompareNoCase(myString1,myString2) & "<br/>") // Returns 0
    writeOutput(CompareNoCase(myString3,myString4) & "<br/>") // Returns -1
    writeOutput(CompareNoCase(myString4,myString3) & "<br/>") // Returns 1
</cfscript>
Output
0

-1

1

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page