mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -04:00
#813 - address PR review comment - brought down visibility.
This commit is contained in:
parent
98b79ae7bf
commit
5539722c69
@ -3,7 +3,7 @@ package org.json;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
public class NumberConversionUtil {
|
class NumberConversionUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a string to a number using the narrowest possible type. Possible
|
* Converts a string to a number using the narrowest possible type. Possible
|
||||||
@ -15,7 +15,7 @@ public class NumberConversionUtil {
|
|||||||
* @throws NumberFormatException thrown if the value is not a valid number. A public
|
* @throws NumberFormatException thrown if the value is not a valid number. A public
|
||||||
* caller should catch this and wrap it in a {@link JSONException} if applicable.
|
* caller should catch this and wrap it in a {@link JSONException} if applicable.
|
||||||
*/
|
*/
|
||||||
public static Number stringToNumber(final String input) throws NumberFormatException {
|
static Number stringToNumber(final String input) throws NumberFormatException {
|
||||||
String val = input;
|
String val = input;
|
||||||
if (val.startsWith(".")){
|
if (val.startsWith(".")){
|
||||||
val = "0"+val;
|
val = "0"+val;
|
||||||
@ -88,7 +88,7 @@ public class NumberConversionUtil {
|
|||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean potentialNumber(String value){
|
static boolean potentialNumber(String value){
|
||||||
if (value == null || value.isEmpty()){
|
if (value == null || value.isEmpty()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.json.junit;
|
package org.json;
|
||||||
|
|
||||||
import org.json.NumberConversionUtil;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
Loading…
x
Reference in New Issue
Block a user