用Matcher 和Pattern类可以实现字符匹配,从而实现判断字符是中文,英文还是数字
Pattern pattern ;
Matcher matcher ;
pattern=Pattern.compile("[a-zA-Z]+");
matcher = pattern.matcher(input);
if(matcher.matches()){
currentMode = MODE_FOREIGN ;
}
pattern = Pattern.compile("[\u4e00-\u9fa5]+");
matcher = pattern.matcher(input);
if(matcher.matches()){
currentMode = MODE_CHINESE ;
}