I located a simple UDF at CFLIB. 

Thanks....

-----Original Message-----
From: Neil Middleton [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 18, 2003 9:13 AM
To: CF-Talk
Subject: RE: Count string occurances in an html file.


off the top of head
---------------------------------------------
<Cfset stringToFind = "test">
<cfset startPos = 1>
<cfset foundCount = 0>

<cfloop from="1" to="1000" index="i" step="1">
        <cfif FindNoCase(stringToFind,cfhttp.fileContent,startPos)>
                <cfset foundCount = incrementValue(foundCount)>
                <cfset startPos =
FindNoCase(stringToFind,cfhttp.fileContent,startPos)
        <cfelse>
                <cfbreak>
        </cfif>
</cfloop>

No Found = #foundCount#
---------------------------------------------

Only problem I can think of this is that the code is limited to only finding
1000 instances, but you tweak this for an expected amount and performance.

Neil

> -----Original Message-----
> From: Bosky, Dave [mailto:[EMAIL PROTECTED]
> Sent: 18 July 2003 14:01
> To: CF-Talk
> Subject: Count string occurances in an html file.
> 
> 
> What would be the best way to count the number of times a
> specific string
> occurs in an html file grabbed using cfhttp?
> 
> Thanks,
> Dave
> 
> 
> 
> 
> HTC Disclaimer:  The information contained in this message
> may be privileged and confidential and protected from 
> disclosure. If the reader of this message is not the intended 
> recipient, or an employee or agent responsible for delivering 
> this message to the intended recipient, you are hereby 
> notified that any dissemination, distribution or copying of 
> this communication is strictly prohibited.  If you have 
> received this communication in error, please notify us 
> immediately by replying to the message and deleting it from 
> your computer.  Thank you.
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to