11.10.2014, 22:10
This is probably the shortest I can write this. And you get a free handy function with it.
pawn Код:
stock IsValidCharacters(characters[])
{
for(new i, j = strlen(characters); i < j; i++) // go over each character in the string separately
{
if(!('A' <= characters[i] <= 'Z' || 'a' <= characters[i] <= 'z' || '0' <= characters[i] <= '9' || in_array(characters[i], { '.', ')', '(', '[', ']', '=', '$', '@' })))
return false;
}
return true;
}
stock in_array(needle, const haystack[], size = sizeof haystack, &index = 0)
{
for(new i; i < size; i++)
{
if(haystack[i] == needle)
{
index = i;
return true;
}
}
return false;
}