本文共 278 字,大约阅读时间需要 1 分钟。
一般这个判断在对未知字符串进行字符转码的时候要用到.
// 判断字符串是否为全角 String input = "dd"; System.out.println(input.matches("[\uFE30-\uFFA0]"));
// 判断字符是否为去全角 char a ='Ⅰ'; if((int)a>255){ System.out.println("为全角"); } else{ System.out.println("为半角"); }
转载地址:http://fnhof.baihongyu.com/