> I have a varchar field size 255 in sql. I want to display only
> the first 6
> words in this field. How do I go about doing that?

Treat the string as a list - delimited by spaces:

<cfset myWords = "Here are a bunch of words in a string. I want the first
six.">
<cfset newWords = "">

<cfloop from="1" to="6" index="ii">
        <cfset newWords = newWords & listgetat(myWords,ii," ") & " ">
</cfloop>

<cfoutput>#newWords#</cfoutput>


- Sean

~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sean Daniels
Manager, Engineering
DealStream.com
[EMAIL PROTECTED]
http://www.dealstream.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tel: 207.439.6030
cel: 978.764.0779



------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to