1000至1k,1000000至1m等数字缩写 [英] 1000 to 1k, 1000000 to 1m etc. number abbreviation
本文介绍了1000至1k,1000000至1m等数字缩写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将1000转换为1k或将1200转换为1.2k?
还有其他编程语言的其他解决方案,但我不知道如何使其与AS3一起使用。
或者有较短的方法可以做到这一点。而不是如果数字> 1000,那么将其设为1k?
解决方案
您难道不就做这样的事
var numInK = bigNumber / 1000 + k;
也许您可以抛出Math.round或其他一些检查来避免像3.3333333K这样的荒谬数字/ p>
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?
解决方案
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
这篇关于1000至1k,1000000至1m等数字缩写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文