Java lang3的 StringUtils.isNumeric(str)不能识别负数和小数。
-
StringUtils.isNumeric( null) = false
-
* StringUtils.isNumeric( "") = false
-
* StringUtils.isNumeric( " ") = false
-
* StringUtils.isNumeric( "123") = true
-
* StringUtils.isNumeric( "\u0967\u0968\u0969") = true
-
* StringUtils.isNumeric( "12 3") = false
-
* StringUtils.isNumeric( "ab2c") = false
-
* StringUtils.isNumeric( "12-3") = false
-
* StringUtils.isNumeric( "12.3") = false
-
* StringUtils.isNumeric( "-123") = false
-
* StringUtils.isNumeric( "+123") = false
如果想判断各种数字类型,用
NumberUtils.isCreatable(str)