You can use regex and delete non-digits.
str = str.replaceAll("\\D+","");
More Related Contents:
- incompatible types required char found java.lang.string
- All possible Angram String combinations in java [closed]
- Change date format in a Java string
- When should we use intern method of String on String literals
- How to convert Java String into byte[]?
- String concatenation: concat() vs “+” operator
- Parse String to Date with Different Format in Java
- Convert character to ASCII numeric value in java
- Strip Leading and Trailing Spaces From Java String
- How can I use “.” as the delimiter with String.split() in java [duplicate]
- How to replace case-insensitive literal substrings in Java
- How to use regex in String.contains() method in Java
- How to check that a string is parseable to a double? [duplicate]
- How to convert current date into string in java?
- Reverse a given sentence in Java
- Extract string between two strings in java
- formatting a string to a currency format in jasper report
- How do I escape a string in Java?
- How to convert a String into an ArrayList?
- Remove end of line characters from Java string
- String Deduplication feature of Java 8
- Convert String to Uri
- Calculating frequency of each word in a sentence in java
- How to remove single character from a String by index
- Remove all non-“word characters” from a String in Java, leaving accented characters?
- Fastest way to strip all non-printable characters from a Java String
- Simple way to sort strings in the (case sensitive) alphabetical order
- Can we access or query the Java String intern (constant) pool?
- Java printf using variable field size?
- Extract digits from string – StringUtils Java