bad nickname
#6

Just wrote that as improved version of the above code now
- Each name must start with a capital and go on with lower case letters
- Names are separted with underscores
- No limit with names, means "Don_Fernando_Flores" as example is valid

pawn Код:
stock IsValidRPName(name[])
{ //Nero_3D © 12.2010
    new idx = strfind(name, "_", false);
    if((idx != -1) && ('A' <= name[0] <= 'Z') && ('A' <= name[idx + 1] <= 'Z')) {
        new i = 1;
        while(i != idx) {
            switch(name[i]) {
                case 'a'..'z': i++;
                default: return 0;
            }
        }
        for(i += 2; ; ) {
            switch(name[i]) {
                case 'a'..'z': i++;
                case '_': return IsValidRPName(name[idx + 1]);
                case EOS: return 1;
                default: return 0;
            }
        }
    }
    return 0;
}
Reply


Messages In This Thread
bad nickname - by dud - 29.12.2010, 11:27
Re: bad nickname - by TouR - 29.12.2010, 11:28
Re: bad nickname - by KotoK - 29.12.2010, 11:40
Re: bad nickname - by dud - 29.12.2010, 12:11
Re: bad nickname - by Voldemort - 29.12.2010, 12:13
Re: bad nickname - by Nero_3D - 29.12.2010, 13:09

Forum Jump:


Users browsing this thread: 1 Guest(s)