引入commons-lang 的jar包 

 

 

 /**
     * 判断是否是数字类型
     * @param str 
     * @return 如果为空返回false  匹配返回true
     */
    public static boolean isInteger(String str) {
        if (StringUtils.isBlank(str)){
            return false;
        }
        Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
        return pattern.matcher(str).matches();
    }

 

相关文章:

  • 2021-11-06
  • 2021-12-19
  • 2021-11-11
  • 2022-02-05
  • 2022-12-23
  • 2021-09-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
相关资源
相似解决方案