Thanks a lot guys...we'll try 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 Matt Woodward Sent: Thursday, February 03, 2005 3:01 PM To: [email protected] Subject: Fwd: count whatever value from .txt file without loop This is from Galen--he's having trouble posting to the list. You might be able to use something like this, key is using the REREPLACENOCASE function to remove everything except the commas, then just get the length of the line. You should be able to do this on the whole text file when you read it into a variable, i would think. <CFSCRIPT> theList='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'; writeoutput("<STRONG>TheList:</STRONG>" & theList & "<BR>"); theNewList=reReplaceNOCASE(theList,"[^,]*","","ALL"); writeoutput("<STRONG>The NewList:</STRONG>" & theNewList & "<BR>"); writeoutput("<STRONG>Number of Commas:</STRONG>" & len(theNewList) & "<BR>"); </CFSCRIPT> Which Gave me: TheList: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 The NewList:,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Number of Commas:29 Galen Smallen [EMAIL PROTECTED] On Thu, 3 Feb 2005 13:46:36 -0600 "Daniel Elmore" <[EMAIL PROTECTED]> wrote: > 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 > > -- Matt Woodward [EMAIL PROTECTED] http://www.mattwoodward.com ---------------------------------------------------------- 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
