Quote:
Originally Posted by Kaliber
Here you are:
PHP код:
stock IsRPName(const name[], max_underscores = 2)
{
new underscores = 0;
if (name[0] < 'A' || name[0] > 'Z') return false;
for(new i = 1; i < strlen(name); i++)
{
if(name[i] != '_' && (name[i] < 'A' || name[i] > 'Z') && (name[i] < 'a' || name[i] > 'z')) return false; // a-zA-Z_
if( (name[i] >= 'A' && name[i] <= 'Z') && (name[i - 1] != '_') ) return false; // indokolatlan nagybetu hasznбlata
if(name[i] == '_')
{
underscores++;
if (underscores>max_underscores) return false; // Underscores more than the maximum, or the last underscore character
if (name [i + 1] <'A' || name [i + 1]> 'Z') return false;
}
}
return (!underscores)?false:true;
}
|
What about max_underscores = 2
Set it to 1 ?