Вопрос

I have this code and I want commas in my numbers. The jackpot is €169.85 but it is displayed as 16985 00 in the game. How to fix that?

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, ' ');
}
Это было полезно?

Решение

ou could try something like;

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;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top