SA-MP Forums Archive
IsNumeric - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: IsNumeric (/showthread.php?tid=262596)



IsNumeric - Wesley221 - 18.06.2011

Hey guys,

Can anyone get me the IsNumeric function/stock (however you call it)?
I've already got this one:
pawn Код:
IsNumeric(const string[])
{
        for (new i = 0, j = strlen(string); i < j; i++)
        {
                if (string[i] > '9' || string[i] < '0') return 0;
        }
        return 1;
}
But someone told me in a chat that this wasn't a good one, and probably wouldnt work that good. Trying to check if an inputtext contains numbers, and if not it gives an error message

~Wesley


Re: IsNumeric - xRyder - 18.06.2011

This IsNumeric() function will work just fine.


Re: IsNumeric - Wesley221 - 18.06.2011

Hmm okay, then i'll just use this one