When and how to trim string
Not sure the best way around this issue. In a query I have the following:
SUBSTRING(blogStories.blogBody,1,220) AS blogBody
Later, when I go to display this, I want to strip the html so I have this:
<cfset trimmedBodyText = REReplaceNoCase(#rsBlog.blogBody#,"<[^>]*>","","ALL")>
<p><cfoutput>#trimmedBodyText#</cfoutput><em> ... (more)</em></p>
This is where the problem comes in. If my SQL query happens to end in the middle of a string like this:
<p>Web 2.0 tools allow opportunities for doing traditional things in new and fundamentally different ways. As Clay Shirky writes in <a target="_blank" href="http://perma://BLPageReference/75484FCE-115D-450B-A2DF-4F71745B
Then the REReplaceNoCase causes problems because there is no end tag.
Can I do this in SQL, or should I pull the whole story, do the REReplaceNoCase and then trim it? If so, what is the command in ColdFusion for trimming? Everything I've found only trims spaces. I can't seem to specify a length anywhere.
