- public static boolean isMobileNO(String mobiles) {
- try {
- Pattern p = Pattern
- .compile("(13[0-9]|14[57]|15[012356789]|18[02356789])\\d{8}");
- Matcher m = p.matcher(mobiles);
- return m.matches();
- } catch (Exception e) {
- return false;
- }
- }
- public static boolean checkEmail(String email) {
- try {
- String check = "([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}";
- Pattern regex = Pattern.compile(check);
- Matcher matcher = regex.matcher(email);
- return matcher.matches();
- } catch (Exception e) {
- return false;
- }
- }
- public static boolean checkChinese(String sequence) {
- final String format = "[//u4E00-//u9FA5//uF900-//uFA2D]";
- boolean result = false;
- Pattern pattern = Pattern.compile(format);
- Matcher matcher = pattern.matcher(sequence);
- result = matcher.find();
- return result;
- }
- public static boolean checkNickname(String sequence) {
- final String format = "[^//u4E00-//u9FA5//uF900-//uFA2D//w-_]";
- Pattern pattern = Pattern.compile(format);
- Matcher matcher = pattern.matcher(sequence);
- return !matcher.find();
- }
- public static String getPhonePass(String phone) {
- if (null == phone || "".equals(phone) || phone.length() < 11) {
- return "";
- }
- String passA = phone.substring(0, 3);
- String passB = phone.substring(phone.length() - 3, phone.length());
- return passA + "*****" + passB;
- }
- public static String getPidPass(String pid) {
- if (null == pid || "".equals(pid) || pid.length() < 18) {
- return "";
- }
- String passA = pid.substring(0, 3);
- String passB = pid.substring(pid.length() - 3, pid.length());
- return passA + "*****" + passB;
- }
来源: http://www.phpxs.com/code/1001595/