NSString的正则匹配
by 伍雪颖
+(BOOL)isOnlyLetters:(NSString *)str {
NSString *lettersRegex = @"[A-Za-z]";
NSPredicate *letters = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",lettersRegex];
return [letters evaluateWithObject:str];
NSString *lettersRegex = @"[A-Za-z]";
NSPredicate *letters = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",lettersRegex];
return [letters evaluateWithObject:str];
}