Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: Javascript千位分隔符/字符串格式
我的问题是:我怎样才能分开一个数字/1000;所以我想做"1243234"to"1 243 234" 或"1000"to"1 000"等。(对不起我的英语=/)
/1000
"1243234"
"1 243 234"
"1000"
"1 000"
> "1243234".replace(/\d(?=(\d{3})+$)/g, "$& ") "1 243 234"
标签值获得水平滚动条,如何格式化?