컴퓨터공학/Java Scala
자바 핸드폰 번호 정규 표현식
igloo2
2012. 5. 26. 01:04
public static boolean isPhoneNum(String s)
{
Pattern telephone = Pattern.compile("(\\d{3})-(\\d{3,4})-(\\d{4})");
Matcher m = telephone.matcher(s);
if (m.matches()){
return true;
}
else {
return false;
}
}