Formatting numbers help!
#6

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Rather crappy function, though. Can be written much shorter. I don't know about others, but I think the most logical approach is to start from the back. Therefore:
PHP код:
AddThousandsSeparators(number, const separator[] = ",")
{
    new 
output[16];
    
format(outputsizeof(output), "%d"number);
    
    for(new 
pos strlen(output) - 3pos 0pos -= 3)
        
strins(outputseparatorpos)
        
    return 
output;

Reply


Messages In This Thread
Formatting numbers help! - by E7mad - 18.12.2015, 19:25
Re: Formatting numbers help! - by Shoulen - 18.12.2015, 20:15
Re: Formatting numbers help! - by SickAttack - 18.12.2015, 20:20
Re: Formatting numbers help! - by Shoulen - 18.12.2015, 20:21
Re: Formatting numbers help! - by E7mad - 18.12.2015, 20:36
Re: Formatting numbers help! - by Vince - 19.12.2015, 00:32

Forum Jump:


Users browsing this thread: 1 Guest(s)