str.replace("\\D", "");
will remove all non-digit characters from the string, then you can just parse it:
Integer.parseInt(str);
More Related Contents:
- Java: check if array is heap
- Java – Unparseable date
- MVC pattern on Android
- What is a difference between
- Get list of JSON objects with Spring RestTemplate
- Ignore duplicates when producing map using streams
- How do different retention policies affect my annotations?
- Parsing JSON array into java.util.List with Gson
- How to change color of the back arrow in the new material theme?
- Gradle to execute Java class (without modifying build.gradle)
- if(false) vs. while(false): unreachable code vs. dead code
- How to get subnet mask of local system using java?
- Java method dispatch with null argument
- Why are class static methods inherited but not interface static methods?
- simple java regex throwing illegalstateexception [duplicate]
- How to persist permission in android API 19 (KitKat)?
- Caused by: java.lang.ClassNotFoundException: Didn’t find class in Firebase Phone Authentication
- Java Reflection: Why is it so slow?
- What’s the best way to get a Class object for an array type?
- Proper implementation of cubic spline interpolation
- Form submit in Spring MVC 3 – explanation
- Apparent connection leak detected with Hikari CP
- Getting unwanted characters when reading command output from SSH server using JSch
- What is the difference between a fluent interface and the Builder pattern?
- Make private methods final?
- Error on some devices – couldn’t find class ‘com.google.android.gms.measurement.internal.zzz’
- Graphics Context misaligned on first paint
- Connecting and printing to a printer in Java
- Is there any “PostConstruct” feature of lombok?
- Integration tests for AspectJ