I am trying to convert a price amount 3,456 which is in string datatype to integer data type. But I'm getting a number format exception error. I have tried parseInt method and valueOf but giving same error.
public static void main(String[] args) {
String name="3,456";
int value= Integer.parseInt(name);
System.out.println(value);
}
Is the comma
,mandatory in your data? Can't you leave it away? If the comma is really there, and those are really integers, just tryname.replace(",","")to remove and then useparseInton that.