RE: Counting the number of words in a field
Try the ListLen() function. This should give you the number of elements (words) in your field. ListLen(List, [delimiter]) HTH, Jeff Garza Lead Developer/Webmaster Spectrum Astro, Inc. 480.892.8200 [EMAIL PROTECTED] http://www.spectrumastro.com -Original Message- From: Perez, Bismark [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 8:20 AM To: CF-Talk 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/ 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
RE: Counting the number of words in a field
Just see how long the list is. ListLen(mylist, ) Phillip -Original Message- From: Perez, Bismark [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 9:20 AM To: CF-Talk 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? Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.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
Re: Counting the number of words in a field
Treat the field as a list with space as delimiters: cfset list = one twothree 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
Re: Counting the number of words in a field
Wow, here's the one time when that behavoir (counting consecutive delimiters as one) would be appropriate! Treat the field as a list with space as delimiters: cfset list = one twothree 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. 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
RE: Counting the number of words in a field
FYI, if anyone is interesting in a UDF that will convert: a,,b to a,,b Check out cflib.org. I posted a UDF, ListFix, last week that does this. It essentially takes care of lists that need to have null entries counted. === Raymond Camden, Principal Spectra Compliance Engineer for Macromedia Email: [EMAIL PROTECTED] Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Tony Schreiber [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 10:49 AM To: CF-Talk Subject: Re: Counting the number of words in a field Wow, here's the one time when that behavoir (counting consecutive delimiters as one) would be appropriate! Treat the field as a list with space as delimiters: cfset list = one twothree 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 __ __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. 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