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