Uncategorized

[알고리즘] 문자열 다루기 기본

https://github.com/imkim1893/algorithms/blob/master/%EB%AC%B8%EC%9E%90%EC%97%B4%EB%8B%A4%EB%A3%A8%EA%B8%B0%EA%B8%B0%EB%B3%B8.java
class Solution {
    public boolean solution(String s) {
        return isCheck(s);
    }
    
    public boolean isCheck(String s){
        try{
            //숫자만으로 구성됨
            Integer.parseInt(s);
            int l = s.length();        
            return (l==4 || l==6);
        }
        catch(Exception e) {
            return false;
        }
    }
}