Determine the mobile phone number belongs to the operator

Source: Internet
Author: User

1     /**2 * Mobile phone number belongs to carrier query3      * @paramPhone4      */5      Public Static voidmobileoperator (String phone) {6         //cmcc-China Mobile phone number rules7String Cmccregex = "^[1]{1} (([3]{1}[4-9]{1}) | ( [5] {1} [89] {1})) [0-9] {8}$ ";8         //cucc-China Unicom mobile phone number rules9String Cuccregex = "^[1]{1} (([3]{1}[0-3]{1}) | ( [5] {1} [3] {1})) [0-9] {8}$ ";Ten         //cnc--China netcom 3G Mobile phone number rules OneString Cncregex = "^[1]{1}[8]{1}[89]{1}[0-9]{8}$"; A          -         if(Phone.length ()!=11){ -System.out.println ("Mobile phone number must be 11-bit"); the}Else if(Phone.matches (Cuccregex)) { -SYSTEM.OUT.PRINTLN ("China Unicom's mobile phone number")); -}Else if(Phone.matches (Cmccregex)) { -System.out.println ("Mobile phone number of China Mobile"); +}Else if(Phone.matches (Cncregex)) { -SYSTEM.OUT.PRINTLN ("China netcom 3G mobile phone Number"); +}Else { ASystem.out.println ("Unknown phone number")); at         } -}

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.