Created
December 28, 2023 14:29
-
-
Save adamcameron/0bac4889614c7fbad1177f0b88f68861 to your computer and use it in GitHub Desktop.
Shows how various functions round in CFML. For comparing CF to Lucee
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
numbers = [511.925,512.925,654.925,655.925] | |
functions = [ | |
"decimalFormat(##x##)", | |
"right(dollarFormat(##x##), -1)", | |
'numberFormat(##x##, "9.00")' | |
] | |
</cfscript> | |
<cfoutput> | |
<table border="1"> | |
<tr> | |
<th>f\x</th> | |
<cfloop index="x" array="#numbers#"><th>#x#</th></cfloop> | |
</tr> | |
<cfloop index="f" array="#functions#"> | |
<tr> | |
<td>#f#</td> | |
<cfloop index="x" array="#numbers#"> | |
<td>#evaluate(f)#</td> | |
</cfloop> | |
</tr> | |
</cfloop> | |
</table> | |
</cfoutput> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment