Properly handle StringUtil.parseInt("0", 0)
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5066 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -518,6 +518,12 @@ public class StringUtil
|
|||||||
str = str.substring(1);
|
str = str.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle this special case immediately, to prevent confusion about
|
||||||
|
// a leading 0 meaning "parse as octal"
|
||||||
|
if (str == "0") {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (radix == 0) {
|
if (radix == 0) {
|
||||||
if (startsWith(str, "0x")) {
|
if (startsWith(str, "0x")) {
|
||||||
str = str.substring(2);
|
str = str.substring(2);
|
||||||
|
|||||||
Reference in New Issue
Block a user