How to remove the letters from the bellow String? String str = “0N1A2G3A4R5A6J7U89”;


public class StringDemoString {

public static void main(String[] args) {
String str = “0N1A2G3A4R5A6J7U89”;
str = str.replaceAll(“[^0-9]”, “”);
System.out.println(str);
}

}
StringDemo

One thought on “How to remove the letters from the bellow String? String str = “0N1A2G3A4R5A6J7U89”;

Leave a comment