Adds commas to a number.
Parameters: none
Data:
value = 2222222
Template:
{{addCommas value}}
Renders to:
2,222,222
Returns the number in abbreviation formats based on a value. The number is rounded to a particular decimal place.
Parameters: digits int
- The number of digits to appear after the decimal point. (Optional)
Default: 2
Data:
value = 123456789
Template:
{{toAbbr value}}
Renders to:
123.457m
Returns the number in exponential notation with one digit before the decimal point, rounded to fractions
digits after the decimal point.
Parameters: fractions int
- An integer specifying the number of digits after the decimal point. (Optional)
Data:
value = 5
Template:
{{toExponential value 5}}
Renders to:
5.00000e+0
Returns exactly digits
after the decimal place. The number is rounded if necessary, and the fractional part is padded with zeros if necessary so that it has the specified length.
Parameters: digits int
- The number of digits to appear after the decimal point. (Optional)
Data:
value = 5.53231
Template:
{{toFixed value 3}}
Renders to:
5.532
Returns a floating point number.
Parameters: none
Data:
value = '22.2abc'
Template:
{{toFloat value}}
Renders to:
22.2
Returns an integer.
Parameters: none
Data:
value = '22.2abc'
Template:
{{toInt value}}
Renders to:
22
Returns the number in fixed-point or exponential notation rounded to precision
significant digits.
Parameters: precision int
- The number of digits. If omitted, it returns the entire number (without any formatting). (Optional)
Data:
value = 555.322
Template:
{{toPrecision value 4}}
Renders to:
555.3
See the template for this page →
Find an error? Let us know →