IOS Verification Mailbox and mobile phone calls

Source: Internet
Author: User

Mailbox

+ (BOOL) Checkemail: (NSString *) email

{

NSString *emailregex = @ "[A-z0-9a-z._%+-][email protected][a-za-z0-9.-]+\\. [A-za-z] {2,4} ";

Nspredicate *emailtest = [Nspredicate predicatewithformat:@ "Self MATCHES%@", Emailregex];

return [Emailtest Evaluatewithobject:email];

}

Cell phone

+ (BOOL) Checkphonenum: (NSString *) numstr

{

NSString * MOBILE = @ "^1 (3[0-9]|5[0-35-9]|7[06-8]|8[0-9]) \\d{8}$";

NSString * CM = @ "^1 (34[0-8]| ( 3[5-9]|5[017-9]|78|8[2-478] \\d) \\d{7}$ ";

NSString * CU = @ "^1 (3[0-2]|5[256]|7[06]|8[56]) \\d{8}$";

NSString * CT = @ "^1 ((33|53|77|8[019)) [0-9]|349] \\d{7}$";

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];

BOOL res1 = [Regextestmobile evaluatewithobject:numstr];

BOOL res2 = [REGEXTESTCM evaluatewithobject:numstr];

BOOL Res3 = [Regextestcu evaluatewithobject:numstr];

BOOL res4 = [REGEXTESTCT evaluatewithobject:numstr];

if (res1 | | res2 | | res3 | | res4)

{

return YES;

}

Else

{

return NO;

}

}

Dial number

Number = @ "13212341234";

[[UIApplication Sharedapplication]openurl:[nsurl urlwithstring:[nsstring stringwithformat:@ "tel://%@", number]];

IOS Verification Mailbox and mobile phone calls

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.