Treat the field as a list with space as delimiters:

<cfset list = "one two                            three">
<cfoutput>#listlen(list," ")#</cfoutput>

CF doesn't count empty list members, so no matter how much consecutive white
space you have between words, this will still return the correct number.



----- Original Message -----
From: "Perez, Bismark" <>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, December 18, 2001 10:19 AM
Subject: Counting the number of words in a field


Is there a way to accomplish this?

I have a database field for which I want to know the number of words it
contains, I though that since a field could also be a list, I'll treat it as
such and try to find the number of white spaces, and that will give me an
approximation of how many words it contains (I trim() the field before
placing it on the DB), but somehow trying to find the number of occurrences
of the white space in the list does not work.  I used the:

ListFind(mylist, " ", " ")

Does anybody knows of a way this will work, in a list setting or through
another way?

____________________________________________________________________________
____
Your ad could be here. Monies from ads go to support these lists and provide
more resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists


________________________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to