Re: show x words not x characters

2009-04-15 Thread Peter Boughton

A sentence is effectively a space-delimited list of words.

So just do ListLeft(myvar,5,' ')

However, words can be an unpredictable length, so this might not be exactly 
what you want.

Here's some code that will give the first 100 characters, keeping words whole, 
and adding a html ellipsis onto the end:



Just change the 90 to 20 or 25, strip the … part, and it should do what 
you want.




~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321625
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: show x words not x characters

2009-04-15 Thread Glyn Jackson

>There should be a UDF for that @ cflib.org I would search for "word count"
>or some such.
>
>G!
>
>On Wed, Apr 15, 2009 at 12:01 PM, Glyn Jackson
>wrote:
>
>>

thanks 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321624
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: show x words not x characters

2009-04-15 Thread Gerald Guido

There should be a UDF for that @ cflib.org I would search for "word count"
or some such.

G!

On Wed, Apr 15, 2009 at 12:01 PM, Glyn Jackson
wrote:

>
> Ho every one, bit of a simple question,
>
> my website shows a snippet of text using the 'left(myvar,30)' function in
> ColdFusion. however this some times cuts off words mid flow, is there a
> function in CF that shows x words and not x characters?
>
> thanks in advance
>
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321622
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: show x words not x characters

2009-04-15 Thread Adrian Lynch

Treat the string as a list with any chars you see fit to be word delimiters,
so spaces, tabs, full stops etc, then extract N elements from the left of
the list.

Adrian

> -Original Message-
> From: Glyn Jackson [mailto:glyn.jack...@newebia.co.uk]
> Sent: 15 April 2009 17:02
> To: cf-talk
> Subject: show x words not x characters
> 
> 
> Ho every one, bit of a simple question,
> 
> my website shows a snippet of text using the 'left(myvar,30)' function
> in ColdFusion. however this some times cuts off words mid flow, is
> there a function in CF that shows x words and not x characters?
> 
> thanks in advance


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321621
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4