How to separate numbers with a Comma
#2

Had a need for it myself yesterday, so I wrote this:
pawn Код:
formatnum(number, const separator[] = ",")
{
    number = clamp(number);
    new output[16];
   
    valstr(output, number);

    for(new i = strlen(output) - 3; i > 0; i -= 3)
    {
        strins(output, separator, i);
    }
    return output;
}
Reply


Messages In This Thread
How to separate numbers with a Comma - by CrazyChoco - 09.07.2013, 17:51
Re: How to separate numbers with a Comma - by Vince - 09.07.2013, 18:00
Re: How to separate numbers with a Comma - by CrazyChoco - 09.07.2013, 18:09
AW: How to separate numbers with a Comma - by roym899 - 09.07.2013, 19:45

Forum Jump:


Users browsing this thread: 1 Guest(s)