number_format
The number_format
filter formats numbers.
You can control the number of decimal places, decimal point, and thousands separator using the additional arguments.
If no formatting options are provided then the default formatting options are:
- 0 decimal places.
- . as the decimal point.
- , as the thousands separator.
{{ 2345.353|number_format }}
// Will print 2,345
{{ 2345.353|number_format(2) }}
// Will print 2,345.35
{{ 9800.3623|number_format(3, '.', ',') }}
// Will print 9,800.362