Work with numbers. Includes "toFixed", "toPrecision", "toExponential", "toInt", "toFloat" and "digitGrouping".
toFixed
Set the digits after a decimal place. The number is rounded or padded with zeros so that it has the specified length.
Parameters
digits [int] - The number of digits to appear after the decimal point. (Optional)
Example
value = 5.53231
{{toFixed value 3}}
Result
5.532
toPrecision
Returns the number in fixed-point or exponential notation rounded to the set precision significant digits.
Parameters
precision [int] - The number of digits. If omitted, it returns the entire number (without any formatting). (Optional)
Example
value = 555.322
{{toPrecision value 4}}
Result
555.3
toExponential
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)
Example
value = 5
{{toExponential value 5}}
Result
5.00000e+0
toInt
Returns an integer.
Parameters
None.
Example
value = '22.2abc'
{{toInt value}}
Result
22
toFloat
Returns a floating point number.
Parameters
None
Example
value = '22.2abc'
{{toFloat value}}
Result
22.2
digitGrouping
Adds thousands separators to a number.
Parameters
separator [string] - A string to use as a digit group separator. (Optional)
Example
value = 2222222
{{digitGrouping value}}
Result
2,222,222