【iOS谓词NSPredicate】用NSPredicate进行模糊判断
//是否由6-16位大小写字母或数字组成
NSString *pattern = @"^[A-Za-z0-9]{6,16}$";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", pattern];
NSLog(@"%d", [predicate evaluateWithObject:_tf.text]);
//用长度作为条件
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"length = 10"];