CFLib.org – Common Function Library Project

NonZero(string)

Last updated December 23, 2002

author

Joshua Miller

Version: 1 | Requires: CF5 | Library: UtilityLib

Description:
NonZero returns TRUE if a value (numeric or text) is not an empty string and is greater than 0.

Return Values:
Returns a boolean.

Example:

<cfset mystring1="">
<cfset mystring2="Sample">
<cfoutput>
MyString1 = #nonzero(mystring1)#<br>
MyString2 = #nonzero(mystring2)#	
</cfoutput>

Parameters:

Name Description Required
string Value to check. Yes

Full UDF Source:

/**
 * NonZero returns TRUE if a value (numeric or text) is not an empty string and is greater than 0.
 * 
 * @param string 	 Value to check. (Required)
 * @return Returns a boolean. 
 * @author Joshua Miller (josh@joshuasmiller.com) 
 * @version 1, December 23, 2002 
 */
function NonZero(string){
	if(string NEQ "" OR string GT 0) return true;
	return false;
}
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