Cool. 

(My eyes bleed every time I see code with no indenting)

Aaron

----- Original Message ----- 
From: "Brett Payne-Rhodes" <[EMAIL PROTECTED]>
To: "CFAussie Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, July 08, 2004 11:58 AM
Subject: [cfaussie] RE: Count occurances of a character in a string


> Thanks everyone. Lots of great ideas and links.
> 
> In the end I looked at some UDF examples of similar functions and then 
> wrote my own very simple UDF:
> 
> <cfscript>
> function countChar(srchString, srchVal) {
>     var charCount=0;
>     var strLen=len(srchString);
>     for (idx=1; idx LTE strLen; idx=idx+1) {
>         if (mid(srchString, idx, 1) eq srchVal) {
>             charCount = charCount + 1;
>         }
>     }
>     return charCount; 
> }
> </cfscript>



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to