Yes. It ensures WORDS are not cut in half. If the string is longer than the
'trimat' attribute, it cuts off the specified amount of text, then works its
way BACK to the first space it finds and chops everything after it, else it
just returns the string as is since it wasn't long enough.

You could change the space to a period but there are plenty of uses for
period that aren't the end of a sentence so it might be a bit tougher.

"Mr. Garrison and Mr. Hat have one weird relationship."

If you cut that at 25 and worked for ONLY full sentences based on periods,
you would get
"Mr. Garrison and Mr."



-----Original Message-----
From: Nate Willard [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 24, 2008 10:58 PM
To: CF-Talk
Subject: RE: Perhaps a little over complicated - Dissecting a String

Thanks bobby. This ensures words are not cut in half, not sentences correct?
Or did I miss something?

Thanks

Bobby Hartsfield <[EMAIL PROTECTED]> wrote: Been using this forever.
 
Author: Bobby Hartsfield | [EMAIL PROTECTED]
File: trimtext.cfm
Description: This tag will take the text passed to it and create a "teaser"
             Meaning, it will trim the text back and add a trailing ... to
the end 
    Making for a good teaser news article with a "read
more" link.
    
    Give the tag the text to trim and the number of
characters to trim it at
    it will trim to that specified number and work its
way "BACK" to the first 
    space character and add ...
    
--->







the "Trimat" attribute --->
 
  
  attribute ---> 
  

 
  any words in half--->          
  listlen(Cutparagraph, " "), " ")>
  #finalparagraph#...
 
  trimat specifications display it without any editing ---> 
  #paragraph#
 




-----Original Message-----
From: Nate Willard [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 24, 2008 7:23 PM
To: CF-Talk
Subject: Re: Perhaps a little over complicated - Dissecting a String

These are all good steps in the right direction however, I haven't found
anything that ties all this logic together. 

Logic
if first sentence is between 200-250 characters show that setence
if no sentence, show first 250 characters +...
if first sentence is less than 250 sentences, get as many sentences as
possible before hitting 250 characters and output.

Has anyone built something like this?

Thanks

Steve Bryant  wrote: I think you want:
#Left(ListFirst(string,"."),100)#.
(untested)

> Instead of returning say just 100 characters. Is there a way to return 
> the first sentence only if its under 100 characters, and if not then 
> 100 characters resulting in a cut off string. 









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

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:302028
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to