listContainsNoCase
Description
Determines the index of the first list element that contains a specified substring.
Categories
Related
Syntax
ListContainsNoCase(list, substring [, delimiters, includeEmptyValues ])
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| delimiters | A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter. | ||
| includeEmptyValues | Optional. Set to yes to include empty values. | ||
| list | A list or a variable that contains one. | ||
| substring | A string or a variable that contains one. The search is case-insensitive. |
Returns
Index
of the first list element that contains substring, regardless
of case. If not found, returns zero.
Usage
ColdFusion ignores empty list elements; thus, the list "a,b,c,,,d" has four elements.
Example
<h3>ListContainsNoCase Example</h3>
<cfif IsDefined("form.letter")>
<!--- First, query to get some values for our list --->
<cfquery name="GetParkInfo" datasource="cfdocexamples">
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>
There are parks in your city!
<cfelse>
Sorry, there were no parks found for your city.
Try searching under a different letter.
</cfif>
</cfif>