Java将Unicode转换成中文
程序员文章站
2022-06-24 20:01:59
...
Java代码:
public static String unicodeToString(String str) {
Pattern pattern = Pattern.compile("(\\\\u(\\p{XDigit}{4}))");
Matcher matcher = pattern.matcher(str);
char ch;
while (matcher.find()) {
ch = (char) Integer.parseInt(matcher.group(2), 16);
str = str.replace(matcher.group(1), ch+"" );
}
return str;
}
原文地址:https://blog.csdn.net/u013066244/article/details/54708179
仅供学习交流,侵删