1 /**
 2      * 判断是否为数字(正负数都行)
 3      * @param str 需要验证的字符串
 4      * @return
 5      */
 6     public static boolean isNumeric(String str){ 
 7        Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); 
 8        Matcher isNum = pattern.matcher(str);
 9        if( !isNum.matches() ){
10            return false; 
11        } 
12        return true; 
13     }

 

相关文章:

  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案