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;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson