August 2001
Intermediate to advanced
976 pages
38h 8m
English
ListFind
ListFind(list, value[,delimiters])
Returns the index of the first occurrence of value in the specified
list. The search is case-sensitive. If no matches are found, 0 is
returned. An optional delimiter can be specified if the list is
delimited with a character other than the comma (the default). The
following example returns the index of the first element in a list
that matches saturday:
<CFSET MyList = "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday"> <CFSET TheValue = "saturday"> <CFSET TheIndex = ListFind(MyList, TheValue)> <CFOUTPUT> <B>List:</B> #MyList# <P><CFIF TheIndex IS 0> The value (#TheValue#) could not be found in the list! <CFELSE> The Value (#TheValue#) was found in element #TheIndex# (#ListGetAt(MyList, TheIndex)#). </CFIF> </CFOUTPUT>
Read now
Unlock full access