nice :)

On 11/23/05, Bobby Hartsfield <[EMAIL PROTECTED]> wrote:
> listfirst(listinsertat(mystring, 11, "***", " "), "***")
>
> ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
> Bobby Hartsfield
> http://acoderslife.com
>
> -----Original Message-----
> From: Charlie Griefer [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 23, 2005 3:38 PM
> To: CF-Talk
> Subject: Re: Getting first 10 words from a string.
>
> there's almost certainly a more eloquent solution, but you can loop
> from 1 to 10 using the space as a delimiter.
>
> <cfset mystring = "the quick brown fox jumped over the lazy dog the
> quick brown fox jumped over the lazy dog" />
> <cfset myTruncatedString = "" />
>
> <cfloop list="#myString#" delimiters=" " index="i">
>     <cfset myTruncatedString = listAppend(myTruncatedString, i, ' ') />
>     <cfif i EQ 10><cfbreak /></cfif>
> </cfloop>
>
> <cfoutput>#myTruncatedString#</cfoutput>
>
> On 11/23/05, Nomad <[EMAIL PROTECTED]> wrote:
> > Hello!
> > Need help.
> >
> > How do I get the first (say 10) words from a string?
> > Problem:
> >
> > A query to my database returns a column (details) that is of memo type. I
> > want to limit the display of this column to the first 10 words only.
> >  I had a quick look at the CFML documentation for string functions but
> could
> > not find any that works with words (not characters).
> > I am obviously missing something. What is it?
> >
> > Thanks a lot.
> >
> > Ben
> >
> >
> >
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225140
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to