+ (BOOL)checkTelNumber:(NSString*) telNumber
{
NSString* pattern =@"^1+[3578]+\\d{9}";
NSPredicate* pred = [NSPredicatepredicateWithFormat:@"SELF MATCHES %@",pattern];
BOOLisMatch = [predevaluateWithObject:telNumber];
returnisMatch;
}
+ (BOOL)checkTelNumber:(NSString*) telNumber
{
NSString* pattern =@"^1+[3578]+\\d{9}";
NSPredicate* pred = [NSPredicatepredicateWithFormat:@"SELF MATCHES %@",pattern];
BOOLisMatch = [predevaluateWithObject:telNumber];
returnisMatch;
}
本文标题:正则判断电话号码
本文链接:https://www.haomeiwen.com/subject/pepxettx.html
网友评论