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:
Tom Conkling
2008-05-09 18:58:42 +00:00
parent bf3a5599f2
commit bf222d2d39
+6
View File
@@ -518,6 +518,12 @@ public class StringUtil
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 (startsWith(str, "0x")) {
str = str.substring(2);