I have a string, that I want to first split and then convert into integer. Here is my code :
String Table_data = "$452";
String[] words=Table_data.split("\\$");
for(String w:words)
{
int result = Integer.parseInt(w);
System.out.print(result);
}
I have not much experience in java.
I tried but its shows some error like "java.lang.NumberFormatException".
Please help. Thank you.
What you probably want is:
String Table_data = "$452";
int result = Integer.parseInt(Table_data.replace("$", ""));