正则表达式:https://www.cnblogs.com/Mustr/p/6060242.html
private void infotext(String txt) {
Pattern p = Pattern.compile("[0-9]*");//Pattern模式compile编译
Matcher m = p.matcher(txt);//matcher匹配器
if(m.matches()){//matches相匹配的
Toast.makeText(Main.this,"输入的是数字", Toast.LENGTH_SHORT).show();
}
p=Pattern.compile("[a-zA-Z]");
m=p.matcher(txt);
if(m.matches()){
Toast.makeText(Main.this,"输入的是字母", Toast.LENGTH_SHORT).show();
}
p=Pattern.compile("[\u4e00-\u9fa5]");
m=p.matcher(txt);
if(m.matches()){
Toast.makeText(Main.this,"输入的是汉字", Toast.LENGTH_SHORT).show();
}
}