Formats a number with a specified number of decimal places, decimal point, and thousands
separator.
Examples
1
2
3
| {{ 1234.56 | number_format }} => "1,234.56"
{{ 1234.56 | number_format: 2 }} => "1,234.56"
{{ 1234.56 | number_format: 2, ',', '.' }} => "1.234,56"
|
Type |
Parameter |
Description |
Required |
float|int |
number |
The number to format. Comes before the | sign. |
Required |
int |
decimals |
The number of decimal places |
|
string |
dec_point |
The decimal point character |
|
string |
thousands_sep |
The thousands separator character |
|
Output
Type |
Description |
string |
The formatted number |