잡지식
java string 문자열에서 숫자인지 문자인지 분류
엉으니
2016. 5. 25. 18:41
public static void checkNullYoungEun(String s) {
String[] trans;
int transLength = 0;
trans = s.split("");
for (int i = 0; i < trans.length; i++) {
if(trans[i].matches("^[a-zA-Z가-힣]$"))
transLength++;
else if (trans[i].matches("^[0-9]$"))
continue;
else
continue;
}
if (transLength > 0) System.out.println("이게 무슨짓이야");
else if (transLength == 0) System.out.println("죠");
}
반응형