format.currency ViewHelper <f:format.currency>

Formats a given float to a currency representation.

Examples

Defaults

<f:format.currency>123.456</f:format.currency>
Copied!

Output:

123,46
Copied!

All parameters

<f:format.currency decimalSeparator="." thousandsSeparator="," decimals="2"
    currencySign="$" prependCurrency="true" separateCurrency="false"
>
    54321
</f:format.currency>
Copied!

Output:

$54,321.00
Copied!

Inline notation

{someNumber -> f:format.currency(thousandsSeparator: ',', currencySign: 'EUR')}
Copied!

Output:

54,321,00 EUR
Copied!

Depending on the value of {someNumber}.

Use dash for decimals without value

<f:format.currency useDash="true">123.00</f:format.currency>
Copied!

Output:

123,-

Copied!

Arguments

currencySign

DataType
string
Required
false
Description
The currency sign, eg $ or .

decimalSeparator

DataType
string
Default
','
Required
false
Description
The separator for the decimal point.

thousandsSeparator

DataType
string
Default
'.'
Required
false
Description
The thousands separator.

prependCurrency

DataType
mixed
Required
false
Description
Select if the currency sign should be prepended

separateCurrency

DataType
mixed
Default
true
Required
false
Description
Separate the currency sign from the number by a single space, defaults to true due to backwards compatibility

decimals

DataType
mixed
Default
2
Required
false
Description
Set decimals places.

useDash

DataType
mixed
Required
false
Description
Use the dash instead of decimal 00