当前位置:网站首页>Unicode string converted to Chinese character decodeunicode utils (tool class II)
Unicode string converted to Chinese character decodeunicode utils (tool class II)
2022-07-07 01:56:00 【Novice Zhang~】
package com.menglar.soap.item.common.utils;
import org.apache.commons.lang3.StringEscapeUtils;
/** * @description: take unicode Convert string to Chinese characters * @author: ZhangRiTian * @create: 2021-10-29 15:08 */
public class DecodeUnicodeUtils {
public static String decodeUnicode(String dataStr) {
// Remove the escape character
dataStr = StringEscapeUtils.unescapeJava(dataStr);
if(!dataStr.contains("\\u")){
return dataStr;}
int start = 0;
int end = 0;
final StringBuffer buffer = new StringBuffer();
while (start > -1) {
end = dataStr.indexOf("\\u", start + 2);
String charStr = "";
if (end == -1) {
charStr = dataStr.substring(start + 2);
} else {
charStr = dataStr.substring(start + 2, end);
}
// 16 Base number parse Shaping string .
char letter = (char) Integer.parseInt(charStr, 16);
buffer.append(letter);
start = end;
}
return buffer.toString();
}
}
边栏推荐
- MySQL execution process and sequence
- ROS学习(十九)机器人SLAM功能包——cartographer
- When grep looks for a process, it ignores the grep process itself
- Ros Learning (23) Action Communication Mechanism
- ROS learning (24) plugin
- 刨析《C语言》【进阶】付费知识【二】
- golang 基础 —— 数据类型
- 编译命令行终端 swift
- JS Es5 can also create constants?
- 制作带照明的DIY焊接排烟器
猜你喜欢
Modify the system time of Px4 flight control
ROS learning (25) rviz plugin
ROS learning (21) robot slam function package -- installation and testing of orbslam
【唯一】的“万字配图“ | 讲透【链式存储结构】是什么?
ROS学习(26)动态参数配置
刨析《C语言》【进阶】付费知识【一】
[advanced C language] 8 written questions of pointer
MySQL execution process and sequence
Appium foundation - appium inspector positioning tool (I)
Blue Bridge Cup 2022 13th provincial competition real topic - block painting
随机推荐
Today's question -2022/7/4 modify string reference type variables in lambda body
ROS learning (22) TF transformation
centos8安裝mysql報錯:The GPG keys listed for the “MySQL 8.0 Community Server“ repository are already ins
Domestic images of various languages, software and systems. It is enough to collect this warehouse: Thanks mirror
Compile command line terminal swift
String to date object
Analyze "C language" [advanced] paid knowledge [II]
JVM memory model
Shortcut keys commonly used in idea
我如何编码8个小时而不会感到疲倦。
微服务架构介绍
Hutool post requests to set the body parameter to JSON data
Analyze "C language" [advanced] paid knowledge [i]
AcWing 1141. 局域网 题解(kruskalkruskal 求最小生成树)
长按按钮执行函数
Errors made in the development of merging the quantity of data in the set according to attributes
AcWing 1142. 繁忙的都市 题解(最小生成树)
永久的摇篮
LeetCode. Sword finger offer 62 The last remaining number in the circle
ROS学习(22)TF变换