<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    無線&移動互聯網技術研發

    換位思考·····
    posts - 19, comments - 53, trackbacks - 0, articles - 283
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    手機號碼驗證---(摘)

    Posted on 2009-06-28 13:33 Gavin.lee 閱讀(567) 評論(0)  編輯  收藏 所屬分類: java SE & EE
    package com.Gavin.tools.util;

    /**
     * **********************************************
     * @description 判斷手機號碼
     * 
    @author Gavin.lee
     * @date Jun 28, 2009    4:57:26 AM
     * 
    @version 1.0
     ***********************************************
     
    */

    public class Mobile {
        
    /**
         * 中國移動擁有號碼段為:139,138,137,136,135,134,159,158,157(3G),151,150,188(3G),187(3G);13個號段
         * 中國聯通擁有號碼段為:130,131,132,156(3G),186(3G),185(3G);6個號段
         * 中國電信擁有號碼段為:133,153,189(3G),180(3G);4個號碼段
         
    */

        
    private static String regMobileStr = "^1(([3][456789])|([5][01789])|([8][78]))[0-9]{8}$";
        
    private static String regMobile3GStr = "^((157)|(18[78]))[0-9]{8}$";
        
    private static String regUnicomStr = "^1(([3][012])|([5][6])|([8][56]))[0-9]{8}$";
        
    private static String regUnicom3GStr = "^((156)|(18[56]))[0-9]{8}$";
        
    private static String regTelecomStr = "^1(([3][3])|([5][3])|([8][09]))[0-9]{8}$";
        
    private static String regTelocom3GStr = "^(18[09])[0-9]{8}$";

        
    private String mobile = "";
        
    private int facilitatorType = 0;
        
    private boolean isLawful = false;
        
    private boolean is3G = false;

        
    public Mobile(String mobile) {
            
    this.setMobile(mobile);
        }


        
    public void setMobile(String mobile) {
            
    if (mobile == null{
                
    return;
            }

            
    /** 第一步判斷中國移動 */
            
    if (mobile.matches(Mobile.regMobileStr)) {
                
    this.mobile = mobile;
                
    this.setFacilitatorType(0);
                
    this.setLawful(true);
                
    if (mobile.matches(Mobile.regMobile3GStr)) {
                    
    this.setIs3G(true);
                }

            }

            
    /** 第二步判斷中國聯通 */
            
    else if (mobile.matches(Mobile.regUnicomStr)) {
                
    this.mobile = mobile;
                
    this.setFacilitatorType(1);
                
    this.setLawful(true);
                
    if (mobile.matches(Mobile.regUnicom3GStr)) {
                    
    this.setIs3G(true);
                }

            }

            
    /** 第三步判斷中國電腦 */
            
    else if (mobile.matches(Mobile.regTelecomStr)) {
                
    this.mobile = mobile;
                
    this.setFacilitatorType(2);
                
    this.setLawful(true);
                
    if (mobile.matches(Mobile.regTelocom3GStr)) {
                    
    this.setIs3G(true);
                }

            }

        }


        
    public String getMobile() {
            
    return mobile;
        }


        
    public int getFacilitatorType() {
            
    return facilitatorType;
        }


        
    public boolean isLawful() {
            
    return isLawful;
        }


        
    public boolean isIs3G() {
            
    return is3G;
        }


        
    private void setFacilitatorType(int facilitatorType) {
            
    this.facilitatorType = facilitatorType;
        }


        
    private void setLawful(boolean isLawful) {
            
    this.isLawful = isLawful;
        }


        
    private void setIs3G(boolean is3G) {
            
    this.is3G = is3G;
        }


        
    public String toString() {
            StringBuffer str 
    = new StringBuffer();
            str.append(
    "mobile:").append(this.getMobile()).append(",")
            .append(
    "facilitatorType:").append(this.getFacilitatorType()).append(",")
            .append(
    "isLawful:").append(this.isLawful()).append(",")
            .append(
    "is3G:").append(this.isIs3G()).append(";");
            
    return str.toString();
        }


        
    public static void main(String[] args) {
            Mobile mobile 
    = new Mobile("13088817413");
            System.out.println(mobile.toString());
        }

    }

    主站蜘蛛池模板: 在线观看亚洲网站| 4虎永免费最新永久免费地址| 亚洲国产精品自在在线观看| 67194国产精品免费观看| 亚洲国产成人久久综合| 曰韩亚洲av人人夜夜澡人人爽| 24小时日本韩国高清免费| 亚洲欧洲精品成人久久曰| 国产亚洲精品自在久久 | 拨牐拨牐x8免费| 72pao国产成视频永久免费| 亚洲国产精品成人综合久久久| 亚洲Av无码乱码在线znlu| 在线a免费观看最新网站| 亚洲免费在线观看| 亚洲精品午夜国产va久久| 亚洲欧洲成人精品香蕉网| 国产精品免费看香蕉| 亚洲美女视频免费| igao激情在线视频免费| 亚洲 欧洲 自拍 另类 校园| 亚洲精品~无码抽插| 国产成人免费a在线视频色戒| 97在线视频免费播放| 久青草视频在线观看免费| 色欲色欲天天天www亚洲伊| 中文字幕亚洲色图| 国产亚洲婷婷香蕉久久精品| 免费国产精品视频| 久久综合AV免费观看| 97在线视频免费播放| 人妻免费一区二区三区最新| 无码一区二区三区亚洲人妻| 国产精品亚洲精品观看不卡| 亚洲无线电影官网| 亚洲AV无码专区电影在线观看| 亚洲精品黄色视频在线观看免费资源| 无码一区二区三区免费视频| 99久久精品免费精品国产| 日本一区午夜艳熟免费| 一级毛片**免费看试看20分钟|