I have suceeded with the help of this community in removing numeric values from user input, however, my code below will only retrieve the alpha characters before the numeric
/*Remove numbers from given specific string*/
public class NewClass6 {
public static void main(String[] args){
String s= "hello647hi74joke";
char[] ch= s.toCharArray();
System.out.println("Result = " + getString(ch));
}
static String getString(char[] ch){
int m = 0;
char[] chr = new char[50];
char[] k = {'0','1','2','3','4','5','6','7','8','9'};
for(int i = 0; i < ch.length; i++){
for(int j = 0; j < k.length; j++){
if(ch[i]==k[j]){
m--;
break;
}
else {
chr[m]=ch[i];
}
}
m++;
}
String st = String.valueOf(chr);
return st;
}
}