使用Pattern类和Matcher类来实现
Pattern.compile("(?i)[a-z]").matcher(string1).find()
返回Boolean值,true表示含有字母。
//替换字母
public static void main(String[] args){
String str="abc123123成你懂吗bxcxsaf";
//通过正则表达式替换掉所有的字母
String strNew = str.replaceAll("[a-zA-Z]","");
System.out.println(strNew);
}