IOS Mailbox Judgment

Source: Internet
Author: User

#pragma mark determines the mailbox's

+ (BOOL) Isvalidateemail: (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];

}


#pragma mark QQ number

+ (BOOL) validateqq: (nsstring *) Email

{

nsstring *emailregex = @ "^\\\\d{5,12}$";

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

return [Emailtest evaluatewithobject: email];

}


#pragma Mark * * #

+ (BOOL) Validateidentitycard: (nsstring *) Identitycard

{

BOOL Flag;

if (Identitycard. length <= 0) {

Flag = NO;

return flag;

}

NSString *regex2 = @ "^ (\\\\d{14}|\\\\d{17}) (\\\\d|[ XX]) $ ";

nspredicate *identitycardpredicate = [nspredicate predicatewithformat:@ "Self MATCHES %@ ", Regex2];

return [Identitycardpredicate evaluatewithobject: Identitycard];

}


#pragma Mark judged his nickname.

+ (BOOL) Validatenickname: (nsstring *) Nickname

{

NSString *phoneregex = @ "[\\u4e00-\\u9fa5]{2,7}";

Nspredicate *phonetest = [Nspredicate predicatewithformat:@ "Self MATCHES%@", Phoneregex];

return [Phonetest evaluatewithobject: nickname];


}

Mobile phone number of the regular, almost all the Internet is not good use, there are bugs, so the proposal still judge mobile phone number 11, is not 1 beginning, I feel it can, can only be the number


This article is from the "11204872" blog, please be sure to keep this source http://11214872.blog.51cto.com/11204872/1755323

IOS Mailbox Judgment

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.