f:format.currency¶
This ViewHelper allows you to display a number in currency format.
Properties¶
currencySign¶
- Variable type
- String
- Description
- The currency symbol, for example £ or €. This symbol is usually appended after the numeric value.
- Default value
- Empty string
- Mandatory
- No
decimalSeparator¶
- Variable type
- String
- Description
- Decimal separator, which separates (for example) Euro and Cent.
- Default value
- ,
- Mandatory
- No
thousandsSeparator¶
- Variable type
- String
- Description
- Character to be used as a thousands separator.
- Default value
- .
- Mandatory
- No
prependCurrency¶
- Variable type
- Boolean
- Description
- Set to TRUE to indicate that the currency symbol should be placed before the numeric value.
- Default value
- FALSE
- Mandatory
- No
separateCurrency¶
- Variable type
- Boolean
- Description
- If this property is TRUE, a space character will be placed between the currency symbol and the numeric value.
- Default value
- TRUE
- Mandatory
- No
decimals¶
- Variable type
- Integer
- Description
- To how many decimal places should the number be rounded?
- Default value
- 2
- Mandatory
- No
Two important pieces of information:
If you pass an empty string to this ViewHelper, it takes 23 milliseconds to return a value. If you pass in 0.00 as a value, then it’ll be finished in 1-2 milliseconds. Take care when working with long lists of values.
This ViewHelper doesn’t accept values passed with a comma as a decimal separator. (Common in German and French usage.)
Examples¶
<f:format.currency currencySign="€" decimalSeparator="." thousandsSeparator="," prependCurrency="true">1122334455.66</f:format.currency>
produces: `€ 1,122,334,455.66
Non-float value¶
<f:format.currency currencySign="€" decimalSeparator="." thousandsSeparator="," prependCurrency="true">1122334455,66</f:format.currency>
produces: € 1,122,334,455.00