久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      正則表達(dá)式實(shí)現(xiàn)手機(jī)號(hào)中間4位數(shù)隱藏或者只顯示末尾四位數(shù)

      下面看下正則表達(dá)式實(shí)現(xiàn)手機(jī)號(hào)中間4位數(shù)隱藏或者只顯示末尾四位數(shù)

        // 匹配手機(jī)號(hào)首尾,以類(lèi)似“123****8901”的形式輸出  '12345678901'.replace(/(d{3})d{4}(d{4})/, '$1****$2');

      此段正則匹配字符串中的連續(xù)11位數(shù)字,替換中間4位為*號(hào),輸出常見(jiàn)的隱匿手機(jī)號(hào)的格式。

      如果要僅得到末尾4位,則可以改成如下形式:

        // 匹配連續(xù)11位數(shù)字,并替換其中的前7位為*號(hào)  '15110280327'.replace(/d{7}(d{4})/, '*******$1');

      ps:下面看下隱藏手機(jī)號(hào)碼中間四位數(shù)

      1.隱藏手機(jī)號(hào)碼中間四位,變成186****9877

        /**   * 隱藏部分手機(jī)號(hào)碼   * @param phone   * @return   */   public static String hidePhoneNum(String phone){   String result = "";   if (phone != null && !"".equals(phone)) {    if (isMobileNum(phone)) {    result = phone.substring(0, 3) + "****" + phone.substring(7);    }   }   return result;   }

      2.判斷是否是手機(jī)號(hào)碼

        /**     * 檢查是否是電話(huà)號(hào)碼     *      * @return     */    public static boolean isMobileNum(String mobiles) {      Pattern p = Pattern          .compile("^((13[0-9])|(14[0-9])|(15[^4,\D])|(18[0-9]))\d{8}$");      Matcher m = p.matcher(mobiles);      return m.matches();    }

      總結(jié)

      以上所述是小編給大家介紹的正則表達(dá)式實(shí)現(xiàn)手機(jī)號(hào)中間4位數(shù)隱藏或者只顯示末尾四位數(shù),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)網(wǎng)站的支持!

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)