How about this:
listLen(originalString,characterToCount)-1
No special non standard functions to get. Just bog standard cf
tags/functions.
This basically pretends that the string you are concerned with is a list,
and that the character you want to count is the list delimiter.
If the character is in there just once, it will 'split' the string into to
list elements, hence why there's a minus one on the end.
It would probably be a safe thing to tack an extra character on the front
and back of the original string, just to rule out problems that might happen
if the character you're counting is the first or last in the string.

Just a thought.

Regards 

Darren Tracey
Systems Analyst
Web Applications, Web and Integration Services
p: + 61 7 3232 4091 (x64091)
f: + 61 7 3232 4744
e: [EMAIL PROTECTED]
l: Lvl 9, 388 Queen St Brisbane QLD 4000
m: Suncorp IPC IT040, GPO Box 1453, Brisbane QLD 4000

> -----Original Message-----
> From: Brett Payne-Rhodes [SMTP:[EMAIL PROTECTED]
> Sent: Thursday, 8 July 2004 0:32
> To:   CFAussie Mailing List
> Subject:      [cfaussie] Count occurances of a character in a string
> 
> Hi,
> 
> Does anyone have a CF function that returns the count of occurance of a 
> character in a string that they would like to share? Or know where I can 
> find one?
> 
> Just heading off to Google but thought I'd ask the experts first ;)
> 
> Thanks,
> 
> Brett
> B)
> 
> -- 
> Brett Payne-Rhodes
> Eaglehawk Computing
> t: +61 (0)8 9371-0471
> f: +61 (0)8 9371-0470
> m: +61 (0)414 371 047
> e: [EMAIL PROTECTED]
> w: www.ehc.net.au
> 
> 
> ---
> 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/


-----------------------------------------------------------------------------------
This e-mail is sent by Suncorp-Metway Limited ABN 66 010 831 722 or one of its related 
entities ("Suncorp"). 

Suncorp may be contacted at Level 18, 36 Wickham Terrace, Brisbane or on 1800 689 762 
or at suncorp.com.au.

The content of this e-mail is the view of the sender or stated author and does not 
necessarily reflect the view of Suncorp. The content, including attachments, is a 
confidential communication between Suncorp and the intended recipient. If you are not 
the intended recipient, any use, interference with, disclosure or copying of this 
e-mail, including attachments, is unauthorised and expressly prohibited. If you have 
received this e-mail in error please contact the sender immediately and delete the 
e-mail and any attachments from your system.

If this e-mail constitutes a commercial message of a type that you no longer wish to 
receive please reply to this e-mail by typing Unsubscribe in the subject line.


---
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