标签: elixir
如何格式化这样的数字: 95263.51
95263.51
带小数点(逗号): 95.263,51
95.263,51
甚至小数点(更常见): 95,263.51?
95,263.51
答案 0 :(得分:1)
找到了做到这一点的方法, 使用Number包: iex> Number.Delimit.number_to_delimited(98765432.98, delimiter: ".",separator: ",") "98 765 432,98"
iex> Number.Delimit.number_to_delimited(98765432.98, delimiter: ".",separator: ",") "98 765 432,98"