Java: removing numeric values from string
You can use:
firstname1 = firstname1.replaceAll("[0-9]","");
This will remove all numeric values from String firstName1
.
String firstname1 = "S1234am";
firstname1 = firstname1.replaceAll("[0-9]","");
System.out.println(firstname1);//Prints Sam
This will remove all digits:
firstname1 = firstname1.replaceAll("\\d","");