Help me
#6

Quote:
Originally Posted by liquor
Посмотреть сообщение
pawn Код:
stock NiceNumber(iNum, const szChar[] = ",")
{
    new
        szStr[16]
    ;
    format(szStr, sizeof(szStr), "%d", iNum);

    for(new iLen = strlen(szStr) - 3; iLen > 0; iLen -= 3)
    {
        strins(szStr, szChar, iLen);
    }
    return szStr;
}


pawn Код:
NiceNumber(12345)

Will output: 12,345 for example
pawn Код:
format(str,sizeof(str),"This is how much it is: %d",NiceNumber(12345));
str will output: This is how much it is: 12,345
Yours is much nicer than mine... my pawn is about 7 years rusty, didn't even think you could return arrays in functions
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: 2 Guest(s)