判断数字类型,是返回true,否返回false
private static Pattern pattern = Pattern.compile("^\\d+$|^\\d+\\.\\d+$|-\\d+$"); private static boolean isNumber(String str) { return pattern.matcher(str).matches(); }