判断string是否为数字

 public static boolean isNumeric1(String str){ 

   str=str.trim().replaceAll(" ", "");

  Pattern pattern = Pattern.compile("[0-9]*");
  return pattern.matcher(str).matches();
 }

你可能感兴趣的:(判断string是否为数字)