java中判断字符串是否为数字

public static boolean isNumeric(String str){
    try {
        Integer.parseInt(str);
        return true;
    } catch (NumberFormatException e) {
        // TODO Auto-generated catch block
        return false;
    }
}
posted @ 2012-07-16 18:37  日光之下无新事  阅读(102)  评论(0编辑  收藏  举报