有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Commons Lang中的java数值验证

在使用org.apache.commons.lang.math.NumberUtils.isNumber(String str)函数时,我发现传递像"1f"这样的字符串可以通过验证,而传递"1a"失败

这里允许什么字母


共 (3) 个答案

  1. # 1 楼答案

    随波逐流

    enter image description here

  2. # 2 楼答案

    the documentation

    Valid numbers include hexadecimal marked with the 0x qualifier, scientific notation and numbers marked with a type qualifier (e.g. 123L).

    1f表示浮点数1

  3. # 3 楼答案

    1f将1作为浮点数

    "1a"不会被视为十六进制值,因为它前面需要0x

    例如:“0x1a