(IOS)判断手机格式

2018-12-26  本文已影响0人  rightmost

+(BOOL)validateWithMobile:(NSString *)mobile

{

    NSString * phone =@"^1([3-9]\\d{9}$)";

    NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",phone];

    return[phoneTest evaluateWithObject:mobile];

}

上一篇 下一篇

猜你喜欢

热点阅读