iOS determines if the phone number is available

Source: Internet
Author: User

+ (BOOL) Valimobile: (NSString *) mobilenum

{

if (mobilenum.length! = 11)

{

return NO;

}

/**

* Mobile Number:

//

130 131 132 133 134 135 136 137 138 139

145 146 147) 148 149

150 151 152 153 155 156 157 158 159

166

170 171 172 175 176 177 178

180 181 182 183 184 185 186 187 188 189

198 199

* Mobile Number segment: 134 135 136 137 138 139 147 148 150 151 152 157 158 159 172 178 182 183 184 187 188 198

* China Unicom: 130 131 132 145 146 155 156 166 171 175 176 185 186

* Signal Segment: 133 149 153 173 174 177 180 181 189 199

* Virtual Carrier: 170

*/

NSString *mobile = @ "^1 (3[0-9]|4[5-9]|5[0-35-9]|66|7[0-25-8]|8[0-9]|9[89]) \\d{8}$";

Nspredicate *regextestmobile = [Nspredicate predicatewithformat:@ "Self MATCHES%@", MOBILE];

if (([regextestmobile evaluatewithobject:mobilenum] = = YES))

{

return YES;

}

Else

{

return NO;

}

}

iOS determines if the phone number is available

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.