CFLib.org – Common Function Library Project

TrueFalseFormat(exp)

Last updated November 29, 2001

author

Rob Brooks-Bilson and Raymond Camden

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Converts Boolean values to either True or False. In ColdFusion, both 'yes', 'no', and numbers can be boolean. This UDF will transate Yes/No 0/N to a 'real' True/False.

Return Values:

Example:

<CFOUTPUT>
#TrueFalseFormat(0)#<BR>
#TrueFalseFormat("Yes")#<BR>
#TrueFalseFormat(1)#<BR>
#TrueFalseFormat("No")#<BR>
#TrueFalseFormat(3)#<BR>
</CFOUTPUT>

Parameters:

Name Description Required
exp value (expression) you want converted to True/False. Yes

Full UDF Source:

/**
 * Converts Boolean values to either True or False.
 * 
 * @param exp      value (expression) you want converted to True/False. 
 * @author Rob Brooks-Bilson and Raymond Camden (rbils@amkor.com, ray@camdenfamily.com) 
 * @version 1, January 29, 2002 
 */
function TrueFalseFormat(exp){
  if (exp) 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