• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1643
  • Last Modified:

Coldfusion MX7- how to truncate output data?

I have a results/detail page set and on my results page I have a field called remarks which is typically very lengthy 500 characters or more, I want to be able to show a preview of the remarks on my results page, limiting the ouput to 100 characters. How can this be accomplished?

Many Thanks!
0
Bang-O-Matic
Asked:
Bang-O-Matic
  • 2
2 Solutions
 
erikTsomikSystem Architect, CF programmer Commented:
try something like this


<cfoutput>#left(Comment,100)#</cfoutput>

Open in new window

0
 
_agx_Commented:
You might also be interested in one of the functions at cflib.org: FullLeft().  It won't chop off the text in the middle of a word.
http://cflib.org/udf.cfm?id=329&enable=1
0
 
_agx_Commented:
Another good function is:  

FormatTeaser()
http://cflib.org/udf.cfm?ID=832
..  display n number of characters from a string with out cutting of in the middle of the word. The function will display a link at the end of the string if it is longer than the number of characters desired ..
0
 
Bang-O-MaticAuthor Commented:
Thanks for the help!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now