compare

Performs a case-sensitive comparison of two strings.
-1, if string1 is less than string2
0, if string1 is equal to string2
1, if string1 is greater than string2

compare(string1, string2) → returns numeric

Argument Reference

string1 string
Required

string2 string
Required

Examples
Sample code invoking the compare function

<cfset comparison = compare("ColdFusion", "coldfusion")>
<cfdump var="#comparison#" />     

Expected Result: -1

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub