Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save trycf/b6b34e9070f758725975c76b21ddcba9 to your computer and use it in GitHub Desktop.

Select an option

Save trycf/b6b34e9070f758725975c76b21ddcba9 to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
boolean function isBool(any val) {
return (arguments.val === true || arguments.val === false);
}
public boolean function isStrictBoolean( required any value ) {
return( isInstanceOf( javacast("", value), "java.lang.Boolean" ) );
}
public boolean function getTrue() {
return true == true;
}
public boolean function getFalse() {
return true == false;
}
values = [
"yes",
"no",
1,
0,
true,
false
];
writeDump({
"a" : isInstanceOf( 1 == 1, "java.lang.Boolean" ),
"b" : isInstanceOf( TRUE, "java.lang.Boolean" )
});
for (i=1; i<=arrayLen(values); i++) {
writeOutput("<p>#values[i]# : #isBool(values[i])#</p>");
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment