Quote:
Originally Posted by !damo!spiderman
I made this up for you... haven't really optimized it at all but it works with any value
PHP код:
stock formatMoney( amount,output[64],delimiter[2]=","){
format(output, sizeof(output), "%i", amount );
if(strlen(output) > 3){
for(new i = 0, j = (strlen(output)/3); i < j; i++){
strins(output, delimiter, strlen(output)-(((i+1)*3)+i) );
}
}
}
// usage
new money = 59329192;
new str[64];
formatMoney(money, str, "." );
printf(str); // Prints 59.329.192
formatMoney(money, str );
print(str); // Prints 59,329,192
|
Nice, I havent gave a though to do it like this. Better than mine wich is manually for every dot. :P