Returns the index of the first element of a list that contains a specified substring within elements. The search is case-insensitive. If no element is found, returns 0.
ListContainsNoCase(list, substring [, delimiters ])
| Parameter |
Description |
|---|---|
| list |
List to search |
| substring |
String sought in elements of list |
| delimiters |
Set of delimiters used in list |
|
Note ColdFusion ignores empty list elements; thus, a list that is defined as "a,b,c,,,d" is treated as a four element list. |
<!--- This example shows ListContainsNoCase --->
<html>
<head>
<title>ListContainsNoCase Example</title>
</head>
<body bgcolor = silver>
<H3>ListContainsNoCase Example</H3>
<cfif IsDefined("FORM.letter")>
<!--- First, query to get some values for our list --->
<cfquery name = "GetParkInfo" datasource = "cfsnippets">
SELECT PARKNAME,CITY,STATE
FROM PARKS
WHERE PARKNAME LIKE '#FORM.letter#%'
</cfquery>
<cfset tempList = ValueList(GetParkInfo.City)>
<cfif ListContainsNoCase(tempList, FORM.yourCity) is not 0 OR
FORM.yourCity is "">
<P><cfif FORM.yourCity is "">The list of parks for the letter
<cfoutput>#FORM.Letter#</cfoutput>
...