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