Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1645
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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