Skip to main content
April 1, 2008
Question

Max characters

  • April 1, 2008
  • 3 replies
  • 546 views
Hello. I want to display a max of 20 characters from a title I pull out of my db that has more than 20 characters. I know this has to be easy but am not sure how to do it.
    This topic has been closed for replies.

    3 replies

    Inspiring
    April 1, 2008
    Another approach is to use your db's string functions and only select 20 characters.
    Astonished_protector15C3
    Participating Frequently
    April 1, 2008
    Hi idesdema,

    Please try the following line of code

    left(trim(query.title),20)
    Inspiring
    April 1, 2008
    <cfif len(trim(query.title)) gt 20>#left(query.title,
    20)#<cfelse>#title#</cfif>

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/