<cfset lst = "1,2,3,,5,,,,9,10" />
#listlen(replace(lst, ',', ', ', 'all'))-1#

-OR-

<cfscript>
        function charCount(str,char)
        {
                var i = 1;
                var cnty = 0;
                for (;i lte len(str); i=i+1)
                {
                        if (mid(lst, i, 1) is char)
                        {
                        cnty = cnty + 1;
                        }
                }
                return cnty;
        }
</cfscript>

<cfset lst = "1,2,3,,5,,,,9,10" />

<cfoutput>#charCount(lst, ',')#</cfoutput>


..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com


-----Original Message-----
From: [EMAIL PROTECTED] [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Saturday, November 24, 2007 8:34 PM
To: CF-Talk
Subject: Re: looping through each row

thanks for the suggestion.

hmm...i did not know about ListLen treating consecutive delimiters as one. 

what can be used instead to determine how many commas , are in each row?

sebastian



>cf treats consecutive delimiters as one, and here is a caveat with your 
>proposed ListLen use:
>
>if your list = "a,b,c,,,f" then listlen(yourlist) will return 4, not 6.
>
>
>---
>Azadi Saryev
>Sabai-dee.com
>http://www.sabai-dee.com 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293776
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