LANG-992 Fix NumberUtils#isNumber() returns false for "0.0", "0.4790", et al
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1582585 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
708da45999
commit
cf03e6173b
|
@ -1364,7 +1364,8 @@ public class NumberUtils {
|
|||
}
|
||||
}
|
||||
return true;
|
||||
} else { // leading 0, but not hex, must be octal
|
||||
} else if (Character.isDigit(chars[start + 1])) {
|
||||
// leading 0, but not hex, must be octal
|
||||
int i = start + 1;
|
||||
for (; i < chars.length; i++) {
|
||||
if (chars[i] < '0' || chars[i] > '7') {
|
||||
|
|
|
@ -1234,6 +1234,12 @@ public class NumberUtilsTest {
|
|||
compareIsNumberWithCreateNumber("00", true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLANG992() {
|
||||
compareIsNumberWithCreateNumber("0.0", true);
|
||||
compareIsNumberWithCreateNumber("0.4790", true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLANG972() {
|
||||
compareIsNumberWithCreateNumber("0xABCD", true);
|
||||
|
|
Loading…
Reference in New Issue