(IOS)判断姓名格式

+(BOOL)validateUserName:(NSString *)name

{

    NSString *userNameRegex =@"^[A-Za-z0-9]{3,20}+$";

    NSPredicate *userNamePredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",userNameRegex];

    BOOLB = [userNamePredicate evaluateWithObject:name];

    returnB;

}

你可能感兴趣的:((IOS)判断姓名格式)