当前位置:网站首页>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();
}
}
边栏推荐
- The cradle of eternity
- Related programming problems of string
- Scenario practice: quickly build wordpress blog system based on function calculation
- 增加 pdf 标题浮窗
- LeetCode. Sword finger offer 62 The last remaining number in the circle
- Yiwen takes you into [memory leak]
- AcWing 904. 虫洞 题解(spfa求负环)
- centos8 用yum 安装MySQL 8.0.x
- Mysqlbackup restores specific tables
- POJ 3177 redundant paths POJ 3352 road construction (dual connection)
猜你喜欢

Appium foundation - appium inspector positioning tool (I)

Can't you understand the code of linked list in C language? An article allows you to grasp the secondary pointer and deeply understand the various forms of parameter passing in the function parameter

Appium自动化测试基础 — uiautomatorviewer定位工具

AcWing 1148. Secret milk transportation problem solution (minimum spanning tree)

Reptile practice (VI): novel of climbing pen interesting Pavilion

猫猫回收站

ROS学习(十九)机器人SLAM功能包——cartographer

蓝桥杯2022年第十三届省赛真题-积木画

Baidu flying general BMN timing action positioning framework | data preparation and training guide (Part 1)

AcWing 361. 观光奶牛 题解(spfa求正环)
随机推荐
Errors made in the development of merging the quantity of data in the set according to attributes
centos8安裝mysql報錯:The GPG keys listed for the “MySQL 8.0 Community Server“ repository are already ins
字符串转成日期对象
设置Wordpress伪静态连接(无宝塔)
刨析《C语言》【进阶】付费知识【完结】
Right mouse button customization
ROS学习(24)plugin插件
AcWing 1148. Secret milk transportation problem solution (minimum spanning tree)
npm install 编译时报“Cannot read properties of null (reading ‘pickAlgorithm‘)“
Related programming problems of string
刨析《C语言》【进阶】付费知识【二】
场景实践:基于函数计算快速搭建Wordpress博客系统
Scenario practice: quickly build wordpress blog system based on function calculation
The cradle of eternity
How to use strings as speed templates- How to use String as Velocity Template?
Set up [redis in centos7.x]
AcWing 1142. 繁忙的都市 题解(最小生成树)
HDU 4661 message passing (wood DP & amp; Combinatorics)
The use of video in the wiper component causes full screen dislocation
ROS学习(十九)机器人SLAM功能包——cartographer