
03.09.2005, 18:07
|
|
Регистрация: Apr 2001
Адрес: Moscow
Сообщений: 1,475
|
Number.prototype.addSuffix = function(word, nul, one, two) {
var n = this%100;
n = n>20 ? n%10 : n;
return word+((n>4 || n == 0) ? nul : (n == 1) ? one : two);
};
ASSetPropFlags(Number.prototype, "addSuffix", 7, 1);
// TEST
for (this.num=33; this.num>=0; this.num--) {
trace(this.num.addSuffix("остал", "ось", "ся", "ось")+" "+this.num+" "+num.addSuffix("", "дней", "день", "дня"));
}
|