正则判断号码

2018-12-25  本文已影响0人  hanyongwei

//判断所有号码

//判断手机号码

NSPredicate *regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", MOBILE];
NSPredicate *regextestcm = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CM];
NSPredicate *regextestcu = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CU];
NSPredicate *regextestct = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CT];

if(([regextestmobile evaluateWithObject:self] == YES)
   || ([regextestcm evaluateWithObject:self] == YES)
   || ([regextestct evaluateWithObject:self] == YES)
   || ([regextestcu evaluateWithObject:self] == YES)){
    return YES;
}else{
    return NO;
}

}

//简单判断是否为电话号码

最简单判断手机号码

上一篇 下一篇

猜你喜欢

热点阅读