Like most dynamic programming languages, ColdFusion can perform mathematical operations with the variables that it handles. However, the results that it returns when it performs such calculations are not always visually appealing or easy to understand. Such is the case with long-form decimals. Displaying them as they are, even with a limit to the amount of numbers displayed, does not always accurately convey a meaning to your user. Fortunately, you can display long-form decimals as percentages in ColdFusion without making any changes to the value of the number.
Open the ColdFusion document with the variable you wish to display as a percentage.
Find or insert the variable that you wish to display. ColdFusion's variable format is the name of the variable between two pound signs, i.e. #DecimalNumber#.
Change the variable to the following format:NumberFormat(DecimalNumber*100, "__")#%
The variable will be displayed as if it were multiplied by 100, with a percentage sign after it. The two underscores are the number mask that determine the format by which the number will display. You can place other characters within the mask, such as decimals, commas for thousand separators, and so on.
Save and publish your page. When your query is run, your long-form decimals will display as percentages.
- Photo Credit Stockbyte/Stockbyte/Getty Images
How to Remove Percentage Signs From Excel
A comprehensive spreadsheet program from Microsoft, Excel offers you a variety of data editing, storage and sorting features. Using the formatting features...
How to Graph Polar Equations
Polar equations are math functions given in the form of R= f (θ). To express these functions you use the polar coordinate...