This article goes over formatting numbers using the roundNum
, commaSeparate
, and numberConvert
functions.
Number Formatting Functions
|
Round a number to specific decimal places |
|
$15.34928 →$15.35 $15 → $15.00 |
|
Separate number with Commas |
|
10000 → 10,000 |
|
Convert integer into text |
|
1000 → one thousand |
|
Convert integer into ordinal text |
|
123 → one hundred twenty third |
Currently
numberConvert
will only work for integers. They will not fully convert numbers with decimals into text but will just print the integer part of the number. (e.g. 101.23 → one hundred and one)You can customize numbers converted to text with numberConvert
by stacking text formatting functions. (e.g. {numShares | numberConvert | upper}
: 1000 → ONE THOUSAND)
You can learn more about text formatting here: Formatting Text Styles: upper, lower, firstCase
Stacking Number Formatting Functions
The order to stack these functions are:
-
roundNum
-
commaSeparate
/numberConvert