例:
// 请输入首位为字母,6-20位数字或字母组合的账号
+ (BOOL)isVaildAccount:(NSString *)account {
NSString *format = @"^([A-Za-z])[A-Za-z0-9]{5,19}$";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"Self matches %@", format];
BOOL isVaildAccount = [predicate evaluateWithObject:account];
return isVaildAccount;
}
网友评论