Is there an alternative to StringUtils.isNumeric that does what I mean?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: StringUtils.isNumeric returns true for "" and false for 7.8. This is of course it's documented behavior, but really not the most convenient for me. Is there something else (ideally in commons.lang) that provides an isActuallyNumeric? 回答1: Try isNumber(String) from org.apache.commons.lang.math.NumberUtils . Checks whether the String [is] a valid Java number. Valid numbers include hexadecimal marked with the 0x qualifier, scientific notation and numbers marked with a type qualifier (e.g. 123L). Null and empty String will return false . UPDATE