CFLib.org – Common Function Library Project

trueFalseToInt(value)

Last updated August 06, 2004

author

Cory Toth

Version: 1 | Requires: CF5 | Library: UtilityLib

Description:
Simple function to format a true / false value to an integer (true=1, false=0). All Values passed to function that are not equal to "true" will be return 0

Return Values:
Returns an integer.

Example:

<cfoutput>
#trueFalseToInt("true")#
</cfoutput>

Parameters:

Name Description Required
value Value to check. Yes

Full UDF Source:

/**
 * Simple function to format a true / false value to an integer (true=1, false=0).
 * 
 * @param value      Value to check. (Required)
 * @return Returns an integer. 
 * @author Cory Toth (ctoth@tmctech.com) 
 * @version 1, August 6, 2004 
 */
function trueFalseToInt(value){
    return iif(value, 1, 0);
}

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