在 Postgres 9.5 中:
select to_char(111, 'FM9,999'); -- gives 111
select to_char(1111, 'FM9,999'); -- gives 1,111
select to_char(11111, 'FM9,999'); -- gives #,### !!!
Run Code Online (Sandbox Code Playgroud)
如何在没有预先了解/假设最大可能数字数的情况下用逗号格式化我的数字,最好使用上面的内置内容?
McN*_*ets 11
添加另一个数字或最大可能值:
select to_char(11111, 'FM9,999,999');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6659 次 |
| 最近记录: |