414
ListFind
Returns the index of the first occurrence of a value within a list. Returns 0 if no value is
found. The search is case-sensitive.
See also
Syntax
ListFind( list , value [, delimiters ])
list
List being searched.
value
Number or string that is to be found in the items of the list.
delimiters
Set of delimiters used in the list.
Examples
<!----------------------------------------------------------------------
This example shows differences between ListContains and ListFind
----------------------------------------------------------------------->
<HTML>
<HEAD>
<TITLE>ListFind/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>
ListContains
and ListFindNoCase.
CFML Language Reference
Need help?
Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?
Questions and answers