国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

Android開發中超好用的正則表達式工具類RegexUtil完整實例

2019-10-22 18:23:53
字體:
來源:轉載
供稿:網友

本文實例講述了Android開發中超好用的正則表達式工具類RegexUtil。分享給大家供大家參考,具體如下:

/*********************************************** * 正則表達式工具 * * @author chen.lin * @version 1.0 ************************************************/public class RegexUtil {  /**   * 車牌號碼Pattern   */  public static final Pattern PLATE_NUMBER_PATTERN = Pattern      .compile("^[/u0391-/uFFE5]{1}[a-zA-Z0-9]{6}$");  /**   * 證件號碼Pattern   */  public static final Pattern ID_CODE_PATTERN = Pattern      .compile("^[a-zA-Z0-9]+$");  /**   * 編碼Pattern   */  public static final Pattern CODE_PATTERN = Pattern      .compile("^[a-zA-Z0-9]+$");  /**   * 固定電話編碼Pattern   */  public static final Pattern PHONE_NUMBER_PATTERN = Pattern      .compile("0//d{2,3}-[0-9]+");  /**   * 郵政編碼Pattern   */  public static final Pattern POST_CODE_PATTERN = Pattern.compile("//d{6}");  /**   * 面積Pattern   */  public static final Pattern AREA_PATTERN = Pattern.compile("//d*.?//d*");  /**   * 手機號碼Pattern   */  public static final Pattern MOBILE_NUMBER_PATTERN = Pattern      .compile("//d{11}");  /**   * 銀行帳號Pattern   */  public static final Pattern ACCOUNT_NUMBER_PATTERN = Pattern      .compile("//d{16,21}");  /**   * 車牌號碼是否正確   *   * @param s   * @return   */  public static boolean isPlateNumber(String s) {    Matcher m = PLATE_NUMBER_PATTERN.matcher(s);    return m.matches();  }  /**   * 證件號碼是否正確   *   * @param s   * @return   */  public static boolean isIDCode(String s) {    Matcher m = ID_CODE_PATTERN.matcher(s);    return m.matches();  }  /**   * 編碼是否正確   *   * @param s   * @return   */  public static boolean isCode(String s) {    Matcher m = CODE_PATTERN.matcher(s);    return m.matches();  }  /**   * 固話編碼是否正確   *   * @param s   * @return   */  public static boolean isPhoneNumber(String s) {    Matcher m = PHONE_NUMBER_PATTERN.matcher(s);    return m.matches();  }  /**   * 郵政編碼是否正確   *   * @param s   * @return   */  public static boolean isPostCode(String s) {    Matcher m = POST_CODE_PATTERN.matcher(s);    return m.matches();  }  /**   * 面積是否正確   *   * @param s   * @return   */  public static boolean isArea(String s) {    Matcher m = AREA_PATTERN.matcher(s);    return m.matches();  }  /**   * 手機號碼否正確   *   * @param s   * @return   */  public static boolean isMobileNumber(String s) {    Matcher m = MOBILE_NUMBER_PATTERN.matcher(s);    return m.matches();  }  /**   * 銀行賬號否正確   *   * @param s   * @return   */  public static boolean isAccountNumber(String s) {    Matcher m = ACCOUNT_NUMBER_PATTERN.matcher(s);    return m.matches();  }}

希望本文所述對大家Android程序設計有所幫助。


注:相關教程知識閱讀請移步到Android開發頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乌兰县| 鹤山市| 冕宁县| 深水埗区| 滨海县| 兴化市| 蓬安县| 仲巴县| 呼和浩特市| 平远县| 渭南市| 石阡县| 揭东县| 丰台区| 孟村| 拜城县| 莫力| 济源市| 黑河市| 开江县| 忻城县| 江西省| 新建县| 新兴县| 贵港市| 都匀市| 平罗县| 三江| 泾川县| 昌都县| 祥云县| 昔阳县| 陵川县| 关岭| 茂名市| 铁力市| 渝北区| 奈曼旗| 灯塔市| 庆元县| 宁波市|