mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
Removes custom XML stringToValue method in favor of keeping a consistent
implementation in JSONObject
This commit is contained in:
parent
39b1c0cb66
commit
3007fc8ebe
3 changed files with 7 additions and 52 deletions
|
@ -1478,7 +1478,6 @@ public class JSONObject {
|
|||
* @return A simple JSON value.
|
||||
*/
|
||||
public static Object stringToValue(String string) {
|
||||
Double d;
|
||||
if (string.equals("")) {
|
||||
return string;
|
||||
}
|
||||
|
@ -1497,13 +1496,13 @@ public class JSONObject {
|
|||
* produced, then the value will just be a string.
|
||||
*/
|
||||
|
||||
char b = string.charAt(0);
|
||||
if ((b >= '0' && b <= '9') || b == '-') {
|
||||
char initial = string.charAt(0);
|
||||
if ((initial >= '0' && initial <= '9') || initial == '-') {
|
||||
try {
|
||||
if (string.indexOf('.') > -1 || string.indexOf('e') > -1
|
||||
|| string.indexOf('E') > -1
|
||||
|| "-0".equals(string)) {
|
||||
d = Double.valueOf(string);
|
||||
Double d = Double.valueOf(string);
|
||||
if (!d.isInfinite() && !d.isNaN()) {
|
||||
return d;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue