How can I extract only the numeric values from the input string?
For example, the input string may be like this:
String str=\"abc d 1234567890pqr 548
public class ExtractNum { public static void main(String args[]) { String input = "abc d 1234567890pqr 54897"; String digits = input.replaceAll("[^0-9.]",""); System.out.println("\nGiven Number is :"+digits); } }