You could replace ,, with ,1, and do a listlen on that.

ListLen(Replace(thestring,",,",",1,","ALL"))

You might have to nest a second replace call in there because I don't know
if CF will replace within a character it has already modified. ( ,,,, might
come out as ,1,,1, )

-Daniel


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Seth Bienek
Sent: Thursday, February 03, 2005 1:39 PM
To: [email protected]
Subject: RE: count whatever value from .txt file without loop


Hey Ron,

The list and token features in CF skip empty values, so there's not a
straightfoward way (that I know of) to count the commas
without some kind of looping.

Maybe a UDF like findit() will do the trick:
http://www.cflib.org/udf.cfm?ID=304

Take Care,

Seth

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ron Mast
> Sent: Thursday, February 03, 2005 1:22 PM
> To: [email protected]
> Subject: RE: count whatever value from .txt file without loop
>
> How do I know it's empty if getToken skips it?
>
> Ron Mast
> Webmaster
> Truth Hardware
> Ph: 507-444-4748
> Fx: 507-444-5361
> www.truth.com
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
> Sent: Thursday, February 03, 2005 11:45 AM
> To: DFWCFUG
> Subject: RE: count whatever value from .txt file without loop
>
> yeah, you could do a replace for the empty commas
>
> On 2/3/2005 10:24:50 AM, [email protected] wrote:
> > Yep
> > that's exactly what we did...:)
> >
> > We have determined how many commas there are per line.
> >
> > BUT, now we have a different issue.
> >
> > Here's
> > what a line looks like:
> > 02/01/2005,12:46,02/01/2005,WBNC,2000001095245,TRUTH HARDWARE
> CO,A,Group
> > defined by system,060148,0000270960,2251.47,,T M COBB CO,RIVERSIDE
> >
> CA,121000248,4159400779,,,,959442,1812.10,0,,959442,,,,,0794,213667.30
> >
> > Can't use getToken because it skips over ",,,,".  I'm thinking that
> > getToken goes to the next "," with a value only.  How do get around
> > that?
> >
> > Ron Mast
> > Webmaster
> > Truth Hardware
> > Ph: 507-444-4748
> > Fx: 507-444-5361
> > www.truth.com
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> > Behalf Of [EMAIL PROTECTED]
> > Sent: Thursday, February 03, 2005 11:17 AM
> > To: DFWCFUG
> > Subject: Re: count whatever value from .txt file without loop
> >
> > use CFFILE to read contents into memory, then consider the
> content as
> a
> > comma delim'd list
> > and use ListLen() function
> >
> > On 2/3/2005 9:41:34 AM, [email protected] wrote:
> > > Hi All,
> > > I want to count how many commas there are in .txt file.
> How do I do
> it
> > > without using cfloop?
> > >
> > > Ron Mast
>
> ----------------------------------------------------------
> To post, send email to [email protected]
> To unsubscribe:
>    http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe:
>    http://www.dfwcfug.org/form_MemberRegistration.cfm
>
>
>
>
> ----------------------------------------------------------
> To post, send email to [email protected]
> To unsubscribe:
>    http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe:
>    http://www.dfwcfug.org/form_MemberRegistration.cfm
>
>
>

----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe:
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe:
   http://www.dfwcfug.org/form_MemberRegistration.cfm





----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to