检测手机号码是否合法,可以加上这几行代码。
String reg = "^[1][358][0-9]{9}$"; Pattern pattern = Pattern.compile(reg); Matcher matcher = pattern.matcher(telephone); boolean b = matcher.matches();
b为true合法,false不合法
本文出自 “移动平台开发” 博客,请务必保留此出处http://liuxudong1001.blog.51cto.com/10877072/1826262
原文:http://liuxudong1001.blog.51cto.com/10877072/1826262