東西不多,但一般項目夠用了。
成都創(chuàng)新互聯(lián)公司為客戶提供專業(yè)的成都網(wǎng)站制作、成都做網(wǎng)站、程序、域名、空間一條龍服務(wù),提供基于WEB的系統(tǒng)開發(fā). 服務(wù)項目涵蓋了網(wǎng)頁設(shè)計、網(wǎng)站程序開發(fā)、WEB系統(tǒng)開發(fā)、微信二次開發(fā)、成都手機網(wǎng)站制作等網(wǎng)站方面業(yè)務(wù)。public class RegularUtil { //身份證 public static final String REGEX_ID_CARD = "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X)$"; //驗證郵箱 public static final String REGEX_EMAIL = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"; //手機號 public static final String REGEX_PHONE = "0?(13|14|15|17|18)[0-9]{9}"; //漢字 public static final String REGEX_TRUENAME = "^[\\u4e00-\\u9fa5]*$"; //銀行卡 public static final String BANKNUMBER="^([0-9]{16}|[0-9]{19})$"; //固話電話正則 public static final String TELE= "([0-9]{3,4}-)?[0-9]{7,8}"; //密碼強度驗證 public static final String REGEX_PWS="^(((?=.*[0-9])(?=.*[a-zA-Z])|(?=.*[0-9])(?=.*[^\\s0-9a-zA-Z])|(?=.*[a-zA-Z])(?=.*[^\\s0-9a-zA-Z]))[^\\s]+)$"; public static boolean isPhone(String mobiles){ if (TextUtils.isEmpty(mobiles)){ return false; }else{ return mobiles.matches(REGEX_PHONE); } } public static boolean isTel(String mobiles) { if (TextUtils.isEmpty(mobiles)) { return false; } else { return mobiles.matches(TELE); } } public static boolean isIDacard(String idcard){ if (TextUtils.isEmpty(idcard)) return false; else return idcard.matches(REGEX_ID_CARD); } public static boolean isBankCard(String bankcard){ if (TextUtils.isEmpty(bankcard)) return false; else return bankcard.matches(BANKNUMBER); } public static boolean isEmail(String email){ if (TextUtils.isEmpty(email)) return false; else return email.matches(REGEX_EMAIL); } public static boolean isTrueName(String name){ if (TextUtils.isEmpty(name)) return false; else return name.matches(REGEX_TRUENAME); } //驗證密碼強度 public static boolean isPsw(String psw) { //包含數(shù)字,字母,特殊符號其中至少兩種 if (TextUtils.isEmpty(psw)) { return false; } else { //限制長度 if(psw.length()<6||psw.length()>16){ return false; } //matches():字符串是否在給定的正則表達式匹配 return psw.matches(REGEX_PWS); } } }
標題名稱:Android常用正則表達式驗證工具類(實例代碼)-創(chuàng)新互聯(lián)
當前鏈接:http://bm7419.com/article8/ijjop.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站維護、網(wǎng)站排名、營銷型網(wǎng)站建設(shè)、網(wǎng)站內(nèi)鏈、外貿(mào)建站、品牌網(wǎng)站設(shè)計
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容