package webget;
public class UnicodeToWord {
public static String convert(String utfString){
StringBuilder sb = new StringBuilder();
int i = -1;
int pos = 0;
while((i=utfString.indexOf("\\u", pos)) != -1){
sb.append(utfString.substring(pos, i));
if(i+5 < utfString.length()){
pos = i+6;
sb.append((char)Integer.parseInt(utfString.substring(i+2, i+6), 16));
}
}
System.out.println(sb.toString());
return sb.toString();
}
}
UnicodeToWord(Java将Unicode码转换成中文)
最新推荐文章于 2024-05-07 06:51:36 发布