Checking if a variable is a number
#2

IsNumeric:

pawn Код:
stock IsNumeric(const string[])
{
        for (new i = 0, j = strlen(string); i < j; i++)
        {
                if (string[i] > '9' || string[i] < '0') return 0;
        }
        return 1;
}
pawn Код:
if(IsNumeric(inputtext))
{
//its a number!
}
else return 1; //not a number.
Reply


Messages In This Thread
Checking if a variable is a number - by slymatt - 25.07.2011, 17:19
Re: Checking if a variable is a number - by Skylar Paul - 25.07.2011, 17:22
Re: Checking if a variable is a number - by iPLEOMAX - 25.07.2011, 17:45
Re: Checking if a variable is a number - by slymatt - 25.07.2011, 17:48
Re: Checking if a variable is a number - by iPLEOMAX - 25.07.2011, 17:57
Re: Checking if a variable is a number - by slymatt - 25.07.2011, 18:03
Re: Checking if a variable is a number - by Dudits - 25.07.2011, 18:18
Re: Checking if a variable is a number - by slymatt - 25.07.2011, 18:19
Re: Checking if a variable is a number - by Libra_PL - 25.07.2011, 18:47
Re: Checking if a variable is a number - by slymatt - 25.07.2011, 18:52

Forum Jump:


Users browsing this thread: 2 Guest(s)