1000 to 1k, 1000000 to 1m etc. number abbreviation

2019-09-22 08:45发布

How can I have 1000 convert to 1k or 1200 to 1.2k? There's other solution for other programming language but I can't figure out how to make it work with AS3.

Or is there a shorter way to do it rather then if number > 1000 then make it 1k?

1条回答
走好不送
2楼-- · 2019-09-22 09:14

Couldn't you just do something like this

var numInK = bigNumber/1000 + "k";

Maybe you could throw in a Math.round or some other checks to avoid ridiculous numbers like 3.3333333K

查看更多
登录 后发表回答