// Default: Use "." as decimal separator, no thousands separator
$engine= new Handlebars($templates, new Numbers());
// German notation
$engine= new Handlebars($templates, new Numbers(decimals: ',', thousands: '.'));
Given a (float)1234.5, the results are as follows:
{{number n}} => 1,234.5 (Uses as many decimals as present)
{{number n decimals=0}} => 1,235 (Rounds)
{{number n decimals=2}} => 1,234.50
Formatting percentages
// Default: Use "%" sign directly behind number
$engine= new Handlebars($templates, new Numbers());
// German notation, including a space between number and "%" sign
$engine= new Handlebars($templates, new Numbers(percent: '# %'));
Given a (float)0.749, the results are as follows:
{{percent n}} => 74.9% (Uses as many decimals as present)
{{percent n decimals=0}} => 75% (Rounds)
{{percent n decimals=2}} => 74.90%
See #1
Formatting numbers
Given a (float)1234.5, the results are as follows:
Formatting percentages
Given a (float)0.749, the results are as follows:
Formatting counts
Handles special cases for 0 items or 1 item.