p.p1 { margin: 0; font: 18px “PingFang SC”; color: rgba(29, 148, 33, 1) }
p.p2 { margin: 0; font: 18px Menlo }
p.p3 { margin: 0; font: 18px Menlo; min-height: 21px }
p.p4 { margin: 0; font: 18px Menlo; color: rgba(201, 27, 19, 1) }
p.p5 { margin: 0; font: 18px Menlo; color: rgba(29, 148, 33, 1) }
span.s1 { font: 18px Menlo; font-variant-ligatures: no-common-ligatures }
span.s2 { font-variant-ligatures: no-common-ligatures }
span.s3 { font-variant-ligatures: no-common-ligatures; color: rgba(195, 34, 117, 1) }
span.s4 { font-variant-ligatures: no-common-ligatures; color: rgba(97, 34, 174, 1) }
span.s5 { font-variant-ligatures: no-common-ligatures; color: rgba(0, 0, 0, 1) }
span.s6 { font-variant-ligatures: no-common-ligatures; color: rgba(61, 29, 129, 1) }
span.s7 { font-variant-ligatures: no-common-ligatures; color: rgba(201, 27, 19, 1) }
span.s8 { font: 18px “PingFang SC”; font-variant-ligatures: no-common-ligatures }

//判断是否是合法的电话号码

+ (BOOL)isChinaMobile:(NSString *)phoneNum{

    BOOL isChinaMobile = NO;

    

    NSString *CM = @”(^1(3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478])\\d{8}$)|(^1705\\d{7}$)”;

    NSPredicate *regextestcm = [NSPredicate predicateWithFormat:@”SELF MATCHES %@”, CM];

    if([regextestcm evaluateWithObject:phoneNum] == YES){

        isChinaMobile = YES;

        //        NSLog(@”中国移动“);

    }

    

    NSString *CU = @”(^1(3[0-2]|4[5]|5[56]|7[6]|8[56])\\d{8}$)|(^1709\\d{7}$)”;

    NSPredicate *regextestcu = [NSPredicate predicateWithFormat:@”SELF MATCHES %@”, CU];

    if([regextestcu evaluateWithObject:phoneNum] == YES){

        isChinaMobile = YES;

        //        NSLog(@”中国联通“);

    }

    

    NSString *CT = @”(^1(33|53|77|8[019])\\d{8}$)|(^1700\\d{7}$)”;

    NSPredicate *regextestct = [NSPredicate predicateWithFormat:@”SELF MATCHES %@”, CT];

    if([regextestct evaluateWithObject:phoneNum] == YES){

        isChinaMobile = YES;

        //        NSLog(@”中国电信“);

    }

    return isChinaMobile;

}

//判断是否是合法的邮箱

+ (BOOL)validateEmail:(NSString *)email{

    NSString *emailRegex = @”[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}”;

    NSPredicate *emailTest = [NSPredicate predicateWithFormat:@”SELF MATCHES %@”, emailRegex];

    return [emailTest evaluateWithObject:email];

}

版权声明:本文为wzy1原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/wzy1/p/7680549.html