Use regular expression to search the first index of number and then use substring(0,index) .. google it on how to use regex in java and substring method. Enjoy coding :)
public class Test {
public static String replaceAll(String string) {
return string.replaceAll("\\d+.*", "");
}
public static void main(String[] args) {
System.out.println(replaceAll("Alian 12WE"));
System.out.println(replaceAll("ANI1451"));
}
}
substring(0,index).. google it on how to use regex in java and substring method. Enjoy coding :)