fix zero parsing error
This commit is contained in:
parent
a3757877a3
commit
befdbefa49
|
@ -11,6 +11,8 @@ public class SafeParse {
|
|||
public static Double stringToDouble(String input) {
|
||||
Double result = 0d;
|
||||
input = input.replace(",", ".");
|
||||
if (input.equals(""))
|
||||
return 0d;
|
||||
try {
|
||||
result = Double.parseDouble(input);
|
||||
} catch (Exception e) {
|
||||
|
@ -22,6 +24,8 @@ public class SafeParse {
|
|||
public static Integer stringToInt(String input) {
|
||||
Integer result = 0;
|
||||
input = input.replace(",", ".");
|
||||
if (input.equals(""))
|
||||
return 0;
|
||||
try {
|
||||
result = Integer.parseInt(input);
|
||||
} catch (Exception e) {
|
||||
|
@ -33,6 +37,8 @@ public class SafeParse {
|
|||
public static Long stringToLong(String input) {
|
||||
Long result = 0L;
|
||||
input = input.replace(",", ".");
|
||||
if (input.equals(""))
|
||||
return 0L;
|
||||
try {
|
||||
result = Long.parseLong(input);
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in a new issue