– Common Function Library Project

LeftDotDot(str[, l])

Last updated May 9, 2009


Peter Coppinger

Version: 0 | Requires: CF5 | Library: StrLib

leftDotDot turns "This is a nice day" into "This is a nic..". You can specify the clipping length. This is very handy when you have a limited layout or just want to give a preview. Or if you just want to ensure that some ridiculously long name doesn't mess things up. We use it extensively in Teamwork Project Manager.

Return Values:
Returns a string


<cfoutput>#HTMLEditFormat( LeftDotDot( productDescription, 50 ) )#</cfoutput>


Name Description Required
str String to use Yes
l length to use No

Full UDF Source:

 leftDotDot turns &quot;This is a nice day&quot; into &quot;This is a nic..&quot;
 @param str 	 String to use (Required)
 @param l 	 length to use (Optional)
 @return Returns a string 
 @author Peter Coppinger ( 
 @version 0, May 9, 2009 
<cffunction name="leftDotDot" output="no" returntype="string">
	<cfargument name="str" type="string" required="yes">
	<cfargument name="l" type="numeric" required="no" default="80">
	<cfset var result = str>
	<cfif Len( str ) GT l>
		<cfset result = Left( Trim(str), l-2 ) & "...">
	<cfreturn result>
blog comments powered by Disqus


Latest Additions

Kevin Cotton added
May 5, 2016

Raymond Camden added
April 25, 2016

Chris Wigginton added
January 18, 2016

Gary Stanton added
November 19, 2015

Sebastiaan Naafs - van Dijk added
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson