03.11.2014, 15:21
Quote:
try this:
pawn Код:
|
if char > TAB OR char < NULL
thats not what we want here.
we want to detect numbers, starting from
decimal 48('0') to 57('9')
the correct way to do that would be
pawn Код:
StringNumeric(const str[])
{
for(new i = 0,ii = strlen(str);i < ii;i++)
{
if(str[i] > '0' && str[i] < '9') return 1;
}
return 0;
}
pawn Код:
printf("str: %d",StringNumeric("tms"));
pawn Код:
printf("str: %d",StringNumeric("tm5s"));
also, instead of calling a function, why not use whats already there by default.
like EOS
the head with the new condition would look like
pawn Код:
for(new i = 0;str[i]!=EOS;i++)
not that it mathers though...