26.12.2012, 05:12
How to convert like this??
$10000 into $10,000
any function please??
saw on many server like this style
$10000 into $10,000
any function please??
saw on many server like this style

stock addCommas(number)
{
new
tStr[13]; // Up to 9,999,999,999,999
format(tStr,sizeof(tStr),"%d",number);
if(strlen(tStr) < 4)
return tStr;
new
//rNumber = floatround((number+(number/3)),floatround_floor),
iPos = strlen(tStr),
iCount = 1;
while(iPos > 0) {
if(iCount == 4) {
iCount = 0;
strins(tStr,",",iPos,1);
iPos ++;
}
iCount ++;
iPos --;
}
return tStr;
}
From the sa-mp wiki, there are plenty of other ones in the useful functions thread. Search
pawn Код:
|