Format.number ViewHelper <f:format.number>

Formats a number with custom precision, decimal point and grouped thousands. See https://www.php.net/manual/function.number-format.php.

Examples

Defaults

<f:format.number>423423.234</f:format.number>
Copied!

423,423.20

With all parameters

<f:format.number decimals="1" decimalSeparator="," thousandsSeparator=".">
    423423.234
</f:format.number>
Copied!

423.423,2

Source code

Go to the source code of this ViewHelper: NumberViewHelper.php (GitHub).

Arguments

The following arguments are available for <f:format.number>:

Name display Type Default
mixed '2'
string '.'
string ','
decimals
Type
mixed
Default
'2'

The number of digits after the decimal point

decimalSeparator
Type
string
Default
'.'

The decimal point character

thousandsSeparator
Type
string
Default
','

The character for grouping the thousand digits