StringUtils.isNumeric()的特殊点

String str = "-1";
StringUtils.isNumeric(str)

返回的是false

StringUtils.isNumeric()方法在判断字符串是否是整数的时候,实现完全没有考虑到 - + 前缀的问题。

例如:【以下的一些特殊例子】

 StringUtils.isNumeric(null)   = false
 StringUtils.isNumeric("")     = true
 StringUtils.isNumeric("  ")   = false
 StringUtils.isNumeric("123")  = true
 StringUtils.isNumeric("12 3") = false
 StringUtils.isNumeric("ab2c") = false
 StringUtils.isNumeric("12-3") = false  
 StringUtils.isNumeric("12.3") = false  //小数
 StringUtils.isNumeric("-3")   = false   //负数
原文地址:https://www.cnblogs.com/renxiaoren/p/6774780.html