Try this UDF:

http://cflib.org/udf/REListFindNoCaseMultiple

Here's the UDF code and a quick example:

<cfset list = '1,2,2,12,12,15'>
<cfdump var="#REListFindNoCaseMultiple('12',list)#">


<cfscript>
/**
* When given a list of values, returns a list of element locations that
match a given regular expression.
*
* @param reg_expr      The regular expression for the search. (Required)
* @param tlist      The list. (Required)
* @param delims      List delimeter. Defaults to a comma. (Optional)
* @return Returns a list of matches.
* @author Robert Munn ([email protected])
* @version 1, October 19, 2004
*/
function REListFindNoCaseMultiple(reg_expr,tlist){
    var results="";
    var expr_location = 0;
    var i = 1;
    var delims = ",";

    if(arrayLen(arguments) gt 2) delims = arguments[3];

    for(; i lte listlen(tlist,delims); i=i+1){
     expr_location = REFindNoCase(reg_expr,listgetat(tlist,i,delims));
     if(expr_location gt 0) results=listappend(results,i);
    }
    return results;
}
</cfscript>

On Fri, Oct 16, 2009 at 12:49 PM, Richard White <[email protected]> wrote:

>
> hi is there a way to count an array/list element occurences
>
> e.g. list="1,2,12,12"
>
> find occurences for '12' would return '2'
>
> thanks
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327285
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to