Help me
#4

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(outputsizeof(output), "%i"amount );
    if(
strlen(output) > 3){
        for(new 
0= (strlen(output)/3); j;  i++){
            
strins(outputdelimiterstrlen(output)-(((i+1)*3)+i) );
        }
    }
}
// usage
new money 59329192;
new 
str[64];
formatMoney(moneystr"." );
printf(str); // Prints 59.329.192
formatMoney(moneystr );
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
Reply


Messages In This Thread
Help me - by Mariciuc223 - 15.07.2015, 09:47
Re: Help me ++REP - by notime - 15.07.2015, 10:37
Re: Help me ++REP - by !damo!spiderman - 15.07.2015, 10:39
Re: Help me ++REP - by notime - 15.07.2015, 10:42
Re: Help me - by liquor - 15.07.2015, 10:47
Re: Help me - by !damo!spiderman - 15.07.2015, 10:52
Re: Help me - by liquor - 15.07.2015, 10:55
Re: Help me - by Virtual1ty - 15.07.2015, 12:27
Re: Help me - by Mariciuc223 - 15.07.2015, 12:45

Forum Jump:


Users browsing this thread: 4 Guest(s)