this 的副本一。
在 Flex/AS3 中,你会用什么在数字的左边填充零?
是否有等效于 printf
或 NumberFormat
这样做吗?
我正在寻找这个或类似的最好的实现:
public function zeroPad(number:int, width:int):String {
// number = 46, width = 4 would return "0046"
}
最佳答案
public function zeroPad(number:int, width:int):String {
var ret:String = ""+number;
while( ret.length < width )
ret="0" + ret;
return ret;
}
关于apache-flex - 你会用什么来在 Flex/AS3 中对数字进行零填充?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/666531/