I think the point is that he's trying to truncate the text in a meaningful way, such as at the end of a sentence. One way around "4.5 houses" is to only use a period as a delimiter if it is followed by at least one space and an uppercase letter. It's not perfect of course, but it would eliminate more edge cases of your truncation not working as intended.
Mike On Mon, Mar 9, 2015 at 1:04 PM, Dean Lawrence <[email protected]> wrote: > > Another option would be to place the entire description in a div and then > truncate it via css. > > http://www.w3schools.com/cssref/css3_pr_text-overflow.asp > > On Sat, Mar 7, 2015 at 1:31 AM, Mark Spence <[email protected]> > wrote: > > > > > I have a long product description I am trying to truncate. I could just > > truncate it, but I don't want to break off sentences. Here is the > solution > > I came up with but it does not seem to have any effect. > > > > Any ideas? > > > > <cfset variables.description = qry_productsGet.productdescription> > > <cfif len(variables.description) gt 200> > > <cfloop condition="i eq false"> > > <cfset variables.description = > > listDeleteAt(variables.description,listLen(variables.description, "."), > > ".")> > > <cfif len(variables.description) lte 200> > > <cfset i = true> > > </cfif> > > </cfloop> > > </cfif> > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360232 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

