How to find List element (case insensitive) in ColdFusion

ListFindNoCase() - find List element (case insensitive)

ListFindNoCase.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ListFindNoCase function example: how to find List element (case insensitive)</title>
</head>

<body>
<h2 style="color:hotpink">ListFindNoCase Function Example: Case-insensitive</h2>

<cfset ColorList="DarkViolet,DeepPink,DarkViolet,DeepSkyBlue">
<cfoutput><b>ColorList: #ColorList#</b></cfoutput>
<br /><br />

<table style="color:LightGreen; background:Green;" border="1" bordercolor="DarkGreen">
    <tr>
     <td style="font-weight:bold">ListFindNoCase Case-insensitive</td>
     <td style="font-weight:bold">Output</td>
    </tr>
    <tr>
     <td>#ListFindNoCase(ColorList,"DarkViolet",",")#</td>
     <td><cfoutput>#ListFindNoCase(ColorList,"DarkViolet",",")#</cfoutput></td>
    </tr>
    <tr>
     <td>#ListFindNoCase(ColorList,"darkViolet",",")#</td>
     <td><cfoutput>#ListFindNoCase(ColorList,"darkViolet",",")#</cfoutput></td>
    </tr>
    <tr>
     <td>#ListFindNoCase(ColorList,"Red",",")#</td>
     <td><cfoutput>#ListFindNoCase(ColorList,"Red",",")#</cfoutput></td>
    </tr>
    <tr>
     <td>#ListFindNoCase(ColorList,"deepskyblue",",")#</td>
     <td><cfoutput>#ListFindNoCase(ColorList,"deepskyblue",",")#</cfoutput></td>
    </tr>
</table>

</body>
</html>





More ColdFusion examples