Can anyone help me to convert a string with both number and character to an integer in Java?
For example, I want to convert a String amount = $100.00 to an int.
I tried to use an integer.parseInt();
but it is giving an error.
String Checkamount = $1400.00; //Convert web element to string.
int intAmount = Integer.parseInt(Checkamount);
Expected result: 1400.00
Error message
Exception in thread "main" java.lang.NumberFormatException: For input string: "$1,400.00" at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)