AS3帮助逗号

时间:2014-02-10 23:59:40

标签: actionscript flash-cs6

我有这个代码,我想要数字中的逗号。 累积奖金为€169.85,但在游戏中显示为16985 00。如何解决?

public function jackpotstring():String {
    var myPattern:RegExp = /./; 
    var jp:Number = jackpot * denom;
    var s:String = jp.toFixed(2)+"";
    return s.replace(/[^A-Za-z0-9 \-_:]+/g, ' ');
}

1 个答案:

答案 0 :(得分:0)

你可以尝试类似的东西;

var jp:Number = jackpot * denom;
jp = Math.round(jp * 100)/100; // value should be something like 1698500
jp = jp / 10000; // value should be something like 169.85 now
var s:String = String(jp);
return s;