08.01.2011, 19:41
Hey,
how can I check if the insert data in a string is a number or not?
how can I check if the insert data in a string is a number or not?
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
new input;
format(input, sizeof(input), "%i", inputtext);
if(input < 12 || input > 120)
{
(407) : error 035: argument type mismatch (argument 1)
(407) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
if(inputtext < 12 || inputtext > 120)
new input[128];//You need to define the length of the input before formating it.
format(input, sizeof(input), "%i", inputtext);
if(inputtext < 12 || inputtext > 120)
{
(406) : error 033: array must be indexed (variable "inputtext")
if(inputtext < 12 || inputtext > 120)
{
//...
if(strval(inputtext) < 12 || strval(inputtext) > 120)