August 2001
Intermediate to advanced
976 pages
38h 8m
English
ListValueCountNoCase — New as of ColdFusion 4.01
ListValueCountNoCase(list,value[,delimiters])
Counts the number of times value appears
in the specified list. The search performed is case-insensitive. An
optional delimiter can be specified if the list is delimited with a
character other than the comma (the default). Here’s an example
that counts the number of times each unique value appears in the list
and outputs the results for each item:
<CFSET MyList = "Apple,orange,apple,Orange,Peach,pear,apple,pear,peach,Pear,
Apple,Peach,orange,apple">
<CFSET UniqueList = "">
<CFLOOP INDEX="Element" LIST="#MyList#">
<CFIF ListFindNoCase(UniqueList, Element) IS "No">
<CFSET UniqueList = ListAppend(UniqueList, Element)>
</CFIF>
</CFLOOP>
<CFOUTPUT><B>Original List:</B> #MyList#</CFOUTPUT>
<P><CFLOOP INDEX="Element" LIST="#UniqueList#">
<CFOUTPUT>
#Element# appears: #ListValueCountNoCase(MyList, Element)# times
regardless of case.<BR>
</CFOUTPUT>
</CFLOOP>Read now
Unlock full access