iOS手机号正则
作者:
少少少少少少少 | 来源:发表于
2016-05-03 14:05 被阅读373次// 手机号正则
NSString *mobileRegex = @"[1][34578][0-9]{9}";
NSPredicate *mobilePredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", mobileRegex];
if (!_phoneTF.text || ![mobilePredicate evaluateWithObject:_phoneTF.text]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"请输入正确的手机号码"
message:@""
delegate:self
cancelButtonTitle:@"确定"
otherButtonTitles:nil, nil];
[alert show];
return;
}```
本文标题:iOS手机号正则
本文链接:https://www.haomeiwen.com/subject/yqzlrttx.html
网友评论