CFLib.org – Common Function Library Project

TrimZero(varToTrim)

Last updated August 26, 2005

author

Praveen Mittal

Version: 2 | Requires: CF6 | Library: StrLib

Description:
Trim traling zeros from a numeric field.

Return Values:
Returns a number.

Example:

<cfoutput>#TrimZero("0.00000")#</cfoutput><br>
<cfoutput>#TrimZero("122.00000")#</cfoutput><br>
<cfoutput>#TrimZero("0.12340000")#</cfoutput><br>
<cfoutput>#TrimZero("0.120042000")#</cfoutput><br>
<cfoutput>#TrimZero("123.0234000")#</cfoutput><br>

Parameters:

Name Description Required
varToTrim Number to trim. Yes

Full UDF Source:

<!---
 Trim traling zeros from a numeric field.
 Version 2 by Raymond Camden
 
 @param varToTrim 	 Number to trim. (Required)
 @return Returns a number. 
 @author Praveen Mittal (praveen@smeng.com) 
 @version 2, August 26, 2005 
--->
<cffunction name="TrimZero" output="false" returnType="string">
	<cfargument name="varToTrim" type="numeric">
	
	<cfreturn arguments.varToTrim + 0>
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson