×

Please give details of the problem

Skip to content

How to format numbers and currencies

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<#assign tmp=1000000.1246>

<#setting locale="fr_FR">
French people write integers like: ${tmp?string("#,###")}
French people write decimals like: ${tmp?string("#,##0.00")}

<#setting locale = "en_US">
US people write integers like: ${tmp?string("#,###")}
US people write decimals like: ${tmp?string("#,##0.00")}

<#setting locale = "es_ES">
Spanish people write integers like: ${tmp?string("#,###")}
Spanish people write decimals like: ${tmp?string("#,##0.00")}

<#setting number_format="currency">
<#setting locale="fr_FR">
rench people write currencies like: ${tmp}

<#setting locale="en_US">
US people write currencies like: ${tmp}

<#setting locale="es_ES">
Spanish people write currencies like: ${tmp}

will return

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
French people write integers like: 1 000 000
French people write decimals like: 1 000 000,12

US people write integers like: 1,000,000
US people write decimals like: 1,000,000.12

Spanish people write integers like: 1.000.000
Spanish people write decimals like: 1.000.000,12

French people write currencies like: 1 000 000,12 €
US people write currencies like: $1,000,000.12
Spanish people write currencies like: 1.000.000,12 €

See also How to format numbers and currencies in Javascript