版权声明:本文为博主原创文章,未经博主允许不得转载。 https://cloud.tencent.com/developer/article/1337772
#pragma mark --- 验证手机号是否合法
NSString *express = @"^0{0,1}(130-9|150-9|180-9|140-9)0-9{8}$";
NSPredicate *pred = NSPredicate predicateWithFormat:@"SELF matches %@", express;
BOOL boo = pred evaluateWithObject:mobilePhone;
return boo;
}