SyntaxFix
Write A Post
Hire A Developer
Questions
Use regular expression is best way to doing this as already mentioned by ashish sahu
public int getInt(String s){ return Integer.parseInt(s.replaceAll("[\\D]", "")); }