方便自己下次使用。
public class checkphone \\)|\\d-)?\\d(-\\d)?$";
/** * 中國電信號碼格式驗證 手機段: 133,153,180,181,189,177,1700,173
* **/
private static final string china_telecom_pattern = "(^1(33|53|7[37]|8[019])\\d$)|(^1700\\d$)";
/** * 中國聯通號碼格式驗證 手機段:130,131,132,155,156,185,186,145,176,1707,1708,1709
* **/
private static final string china_unicom_pattern = "(^1(3[0-2]|4[5]|5[56]|7[6]|8[56])\\d$)|(^170[7-9]\\d$)";
/** * 中國移動號碼格式驗證
* 手機段:134,135,136,137,138,139,150,151,152,157,158,159,182,183,184
* ,187,188,147,178,1705
* **/
private static final string china_mobile_pattern = "(^1(3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478])\\d$)|(^1705\\d$)";
/** * 僅手機號格式校驗
*/ .tostring();
/** * 手機和座機號格式校驗
*/ .tostring();
/** * 匹配多個號碼以,、或空格隔開的格式,如
* 17750581369 13306061248、(596)3370653,17750581369,13306061248 (0596)3370653
*/private static final string multi_phone_tel_pattern="^(?:(?:(?:(?:(?:(?:13[0-9])|(?:14[57])|(?:15[0-35-9])|(?:17[36-8])|(?:18[0-9]))\\d)|(?:170[057-9]\\d)|(?:\\(\\d\\)|\\d-)?\\d(?:-\\d)?)[,\\s、])+)?(?:(?:(?:(?:13[0-9])|(?:14[57])|(?:15[0-35-9])|(?:17[36-8])|(?:18[0-9]))\\d)|(?:170[057-9]\\d)|(?:\\(\\d\\)|\\d-)?\\d(?:-\\d)?)$";
/** * 匹配多個號碼以,、或空格隔開的格式,如
* 17750581369 13306061248、(596)3370653,17750581369,13306061248 (0596)3370653
* @param input
* @return
*/public static boolean checkmultiphone(string input)
/** * 僅手機號碼校驗
* @param input
* @return
*/public static boolean isphone(string input)
/** * 手機號或座機號校驗
* @param input
* @return
*/public static boolean isphoneortel(string input)
/** * 驗證**號碼的格式
* * @author linbilin
* @param str
* 校驗**字串
* @return 返回true,否則為false
*/public static boolean isphonecallnum(string str)
/** * 驗證【電信】手機號碼的格式
* * @author linbilin
* @param str
* 校驗手機字串
* @return 返回true,否則為false
*/public static boolean ischinatelecomphonenum(string str)
/** * 驗證【聯通】手機號碼的格式
* * @author linbilin
* @param str
* 校驗手機字串
* @return 返回true,否則為false
*/public static boolean ischinaunicomphonenum(string str)
/** * 驗證【移動】手機號碼的格式
* * @author linbilin
* @param str
* 校驗手機字串
* @return 返回true,否則為false
*/public static boolean ischinamobilephonenum(string str)
/** * 匹配函式
* @param regex
* @param input
* @return
*/private static boolean match(string regex, string input)
驗證手機號碼工具類
驗證手機號碼 author dujiayu time 2020年4月25日11 12 57 public class numberutil 用於匹配固定 號碼 private final static string regex fixedphone 010 02 d 0 3 9 d d 用於獲取固定...
手機號碼 正則匹配工具類
public class phoneutils 大陸手機號碼11位數,匹配格式 前三位固定格式 後8位任意數 此方法中前三位格式有 13 任意數 15 除4的任意數 18 除1和4的任意數 17 除9的任意數 14 5 7 9 166 19 8 9 public static boolean isc...
獲取手機號碼
使用telephonymanager.getdefault getline1number 已經不能獲得目前移動sim卡的 號碼了,老的sim卡也許可以,現在介紹一種方法,可以獲得手機號碼 cursor mycursor getcontentresolver query uri.parse conte...