Only words
#8

Your example has a lot of unneeded stuff.
Also, the 'ultimate' version would be this

pawn Код:
IsNumeric(const string[])
{
    if (!strval(string))
    {
        for (new i = 0, j = strlen(string); i < j; i++)
        {
            if (string[i] != '0') return 0;
        }
    }
    return 1;
}
pawn Код:
printf("%d\n", IsNumeric("0000")); //returns 1
    printf("%d\n", IsNumeric("2341")); //returns 1
    printf("%d\n", IsNumeric("+2341")); //returns 1
    printf("%d\n", IsNumeric("-2341")); //returns 1
    printf("%d\n", IsNumeric("jhb342u")); //returns 0
Reply


Messages In This Thread
Only words - by Dws - 23.06.2010, 18:02
Re: Only words - by Hiddos - 23.06.2010, 18:20
Re: Only words - by Backwardsman97 - 23.06.2010, 18:23
Re: Only words - by dice7 - 23.06.2010, 18:25
Re: Only words - by Dws - 23.06.2010, 18:27
Re: Only words - by dice7 - 23.06.2010, 18:28
Re: Only words - by (SF)Noobanatior - 23.06.2010, 18:31
Re: Only words - by dice7 - 23.06.2010, 18:37
Re: Only words - by Dws - 23.06.2010, 18:44

Forum Jump:


Users browsing this thread: 1 Guest(s)