I have a String and I want to extract the (only) sequence of digits in the string.
Example: helloThisIsA1234Sample. I want the 1234
It\'s a given that the s
Try this approach if you have symbols and you want just numbers:
String s = "@##9823l;Azad9927##$)(^738#";
System.out.println(s=s.replaceAll("[^0-9]", ""));
StringTokenizer tok = new StringTokenizer(s,"`~!@#$%^&*()-_+=\\.,>");
String s1 = "";
while(tok.hasMoreTokens()){
s1+= tok.nextToken();
}
System.out.println(s1);