29.01.2014, 14:52
After checking that the name is valid (Name_Lastname, it uses only 1 underscore and not at the start or end etc), use:
pawn Код:
if (CheckChars(inputtext))
{
// your code
}
pawn Код:
stock CheckChars(const source[], length = sizeof (source))
{
if (!(--length)) return 0;
new
pos = strfind(source, "_");
for (new i; i != length; ++i)
{
if (!i || i == pos + 1)
{
switch (source[i])
{
case 'A' .. 'Z': continue;
default: return 0;
}
}
else if (i && i != pos && i != pos + 1)
{
switch (source[i])
{
case 'a' .. 'z': continue;
default: return 0;
}
}
}
return 1;
}