Basically my questions is how can i remove the digits from a string that is being inputted Thanks for helping me as well
Example:
Input
700N
Output:
N
Basically my questions is how can i remove the digits from a string that is being inputted Thanks for helping me as well
700N
N
You can use replaceAll
String st1 = "700N";
st1 = st1.replaceAll("\\d+", "");
System.out.println(st1);
output
N
The best way I could come up with :
String input ="700N";
String output= input.replaceAll("\\d","");
The regex \\d
means digit.