Keep

2025 第 32 周

发布:

格式化结果

0¥0.00
1¥1.00
-1-¥1.00
12.3¥12.30
-12.3-¥12.30
1234.5¥1,234.50
123456.789¥123,456.79
当前 Intl 选项(JSON)
{
  "style": "currency",
  "currency": "CNY",
  "currencyDisplay": "symbol",
  "notation": "standard",
  "signDisplay": "auto",
  "useGrouping": true,
  "roundingMode": "halfExpand",
  "roundingPriority": "auto"
}
构造代码片段
const fmt = new Intl.NumberFormat('zh-CN', {
  "style": "currency",
  "currency": "CNY",
  "currencyDisplay": "symbol",
  "notation": "standard",
  "signDisplay": "auto",
  "useGrouping": true,
  "roundingMode": "halfExpand",
  "roundingPriority": "auto"
});
fmt.format(123456.789);
        

avatar image

@read2025, 生活在北京(北漂),程序员,,跑步,马拉松[334],喜欢动漫。 "骑士总能救出公主,是因为恶龙从没伤害过她"