Use this code numberOnly will contain your desired output.
String str="sdfvsdf68fsdfsf8999fsdf09";
String numberOnly= str.replaceAll("[^0-9]", "");
More Related Contents:
- StringUtils.isBlank() vs String.isEmpty()
- Why there is no countOf method in the String Class? [closed]
- How to store a string array inside a string in java
- Can I product of charAt in Java? [duplicate]
- Android String that change every day
- How to capitalize the first character of each word in a string
- Convert String to double in Java
- How to enter quotes in a Java string?
- Best way to convert an ArrayList to a string
- String, StringBuffer, and StringBuilder
- String concatenation: concat() vs “+” operator
- Convert character to ASCII numeric value in java
- Strip Leading and Trailing Spaces From Java String
- Where does Java’s String constant pool live, the heap or the stack?
- How do I convert a byte array to Base64 in Java?
- 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?
- Converting List to List
- Why doesn’t String’s hashCode() cache 0?
- Easy way to remove accents from a Unicode string? [duplicate]
- How do I escape a string in Java?
- Remove end of line characters from Java string
- String Deduplication feature of Java 8
- Java collections convert a string to a list of characters
- How to remove single character from a String by index
- Simple way to sort strings in the (case sensitive) alphabetical order
- Is there a memory-efficient replacement of java.lang.String?
- Compare two hex strings in Java?