Formatting numbers with thousands separator Smarty

2020-02-17 09:16发布

Im trying to format numbers with thousands separator Smarty.

So for example 1000 becomes 1,000.

Thanks.

标签: smarty
3条回答
家丑人穷心不美
2楼-- · 2020-02-17 09:22

or just in smarty use {$var|number_format:0}

查看更多
时光不老,我们不散
3楼-- · 2020-02-17 09:25

or you can use php function inside smarty, this is for number_format, you can use other php function too :)

PHP : number_format($number, 2, '.', ',');

SMARTY :
{$number|number_format:2:".":","}
查看更多
仙女界的扛把子
4楼-- · 2020-02-17 09:44

Try to use string_format, it uses sprintf to format your string.

查看更多
登录 后发表回答