String ChineseCharactersStr = “这里是汉字也有yingwen”;
需要导入
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Pattern p = Pattern.compile(“[\u4e00-\u9fa5]”);
Matcher m = p.matcher(ChineseCharactersStr );
if (m.find()) {
//则证明有汉字
}
String ChineseCharactersStr = “这里是汉字也有yingwen”;
需要导入
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Pattern p = Pattern.compile(“[\u4e00-\u9fa5]”);
Matcher m = p.matcher(ChineseCharactersStr );
if (m.find()) {
//则证明有汉字
}