package com.opensesame.core.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TelephoneUtils {
public static boolean isMobile(String str) {
Pattern p = null;
Matcher m = null;
boolean b = false;
p = Pattern.compile("^[1][3,4,5,6,7,8,9][0-9]{9}$");
m = p.matcher(str);
b = m.matches();
return b;
}
public static boolean isPhone(String str) {
Pattern p1 = null, p2 = null;
Matcher m = null;
boolean b = false;
p1 = Pattern.compile("^[0][1-9]{2,3}-[0-9]{5,10}$");
p2 = Pattern.compile("^[1-9]{1}[0-9]{5,8}$");
if (str.length() > 9) {
m = p1.matcher(str);
b = m.matches();
} else {
m = p2.matcher(str);
b = m.matches();
}
return b;
}
}