How to convert string value into int? I am getting number format exception
.
String s = "20.00";
int i = (Integer.parseInt(s));
System.out.println(i);
Result should be like i=20
.
What about:
int i = (int) Double.parseDouble(s);
Of course, "20.00"
is not in a valid integer format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With