How to find List element (case sensitive) in ColdFusion

ListFind() - find List element (case sensitive)

ListFind.cfm


<!DOCTYPE html>

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

<body>
<h2 style="color:hotpink">ListFind Function Example: Case-sensitive</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">ListFind Case-sensitive</td>
     <td style="font-weight:bold">Output</td>
    </tr>
    <tr>
     <td>#ListFind(ColorList,"DarkViolet",",")#</td>
     <td><cfoutput>#ListFind(ColorList,"DarkViolet",",")#</cfoutput></td>
    </tr>
    <tr>
     <td>#ListFind(ColorList,"darkViolet",",")#</td>
     <td><cfoutput>#ListFind(ColorList,"darkViolet",",")#</cfoutput></td>
    </tr>
    <tr>
     <td>#ListFind(ColorList,"Red",",")#</td>
     <td><cfoutput>#ListFind(ColorList,"Red",",")#</cfoutput></td>
    </tr>
    <tr>
     <td>#ListFind(ColorList,"DeepSkyBlue",",")#</td>
     <td><cfoutput>#ListFind(ColorList,"DeepSkyBlue",",")#</cfoutput></td>
    </tr>
</table>

</body>
</html>





More ColdFusion examples