410
CFML Language Reference
ListContains
Returns the index of the first item that contains the specified substring. The search is
case-sensitive. If the substring is not found in any of the list items, it returns zero (0).
See also
ListContainsNoCase
and
ListFind
.
Syntax
ListContains
(
list, substring [, delimiters ])
list
List being searched.
substring
String being sought in elements of list.
delimiters
Set of delimiters used in list.
Examples
<!----------------------------------------------------------------------
This example shows differences between ListContains and ListFind
----------------------------------------------------------------------->
<HTML>
<HEAD>
<TITLE>ListContains</TITLE>
</HEAD>
<BODY>
<!----------------------------------------------------------------------
Create a list composed of the items one, two, three.
----------------------------------------------------------------------->
<CFSET aList="one">
<CFSET aList=ListAppend(aList, "two")>
<CFSET aList=ListAppend(aList, "three")>
<P>
Here is the list: <B><CFOUTPUT>#aList#</CFOUTPUT></B>
<P>
ListContains checks for the existence of a substring "wo" in the items in
the list.
<BR>ListContains<BR>
<CFOUTPUT>
The substring "wo" is in <B>Item #ListContains(aList, "wo")#</B> of the
list.
</CFOUTPUT>
<P>
ListFind cannot check for substrings within items; therefore, in the
following code where ListFind in used in place of ListContains, it will
not find the substring "wo" in the list.
<BR>ListFind<BR>
<CFOUTPUT>
The substring "wo" is in <b>Item #ListFind(aList, "wo")#</b> of the list.
</CFOUTPUT>
Summary of Contents for COLDFUSION 4.5-CFML LANGUAGE
Page 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Page 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Page 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Page 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Page 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Page 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Page 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Page 584: ...560 CFMLLanguageReference...
Page 594: ...570 CFMLLanguageReference...