Little question :)
#7

Both Vince's and my code work good. What are you trying to accomplish anyway?

EDIT: Okay, I see "-,100,000,000". Replace with:
pawn Код:
for (new i = strlen(string) - 1, j = ((integer < 0) ? 1 : 0); i > j; --i)
and it'll be fixed.

EDIT 2: Or even better as Vince tip:

pawn Код:
IntegerWithDelimiter(integer, delimiter[] = ",")
{
    new
        string[16];

    format(string, sizeof(string), "%d", integer);

    for (new i = strlen(string) - 3, j = ((integer < 0) ? 1 : 0); i > j; i -= 3)
    {
        strins(string, delimiter, i, sizeof (string));
    }
    return string;
}
Reply


Messages In This Thread
Little question :) - by bgedition - 31.05.2015, 15:34
Re: Little question :) - by Konstantinos - 31.05.2015, 15:58
Re: Little question :) - by Vince - 31.05.2015, 16:54
Re: Little question :) - by Konstantinos - 31.05.2015, 17:29
Re: Little question :) - by bgedition - 31.05.2015, 17:44
Re: Little question :) - by bgedition - 01.06.2015, 11:12
Re: Little question :) - by Konstantinos - 01.06.2015, 11:25
AW: Little question :) - by Kaliber - 01.06.2015, 11:26
Re: Little question :) - by bgedition - 01.06.2015, 11:49

Forum Jump:


Users browsing this thread: 2 Guest(s)