java判断中文字符是否包含生僻字

RT.

public class test01 {

    public static Boolean isLessUseWord(String org) throws UnsupportedEncodingException {
        return !org.equals(new String(org.getBytes("gb18030"),"gb2312"));
    }

    public static void main(String[] args) throws Exception{
        System.out.println(isLessUseWord("三")+"-"+isLessUseWord("毿"));
    }

}

console:

false-true

猜你喜欢

转载自blog.csdn.net/i929479824/article/details/115694138