当前位置:网站首页>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();
}
}
边栏推荐
- hdu 4661 Message Passing(木DP&组合数学)
- sql中批量删除数据---实体中的集合
- 制作带照明的DIY焊接排烟器
- 百度飞将BMN时序动作定位框架 | 数据准备与训练指南 (下)
- IDEA常用的快捷键
- 修改px4飞控的系统时间
- 2022 system integration project management engineer examination knowledge point: Mobile Internet
- Blue Bridge Cup 2022 13th provincial competition real topic - block painting
- 猫猫回收站
- PartyDAO如何在1年内把一篇推文变成了2亿美金的产品DAO
猜你喜欢
[advanced C language] 8 written questions of pointer
Gin introduction practice
AcWing 345. 牛站 题解(floyd的性质、倍增)
Right mouse button customization
CISP-PTE之命令注入篇
AcWing 345. Cattle station solution (nature and multiplication of Floyd)
Blue Bridge Cup 2022 13th provincial competition real topic - block painting
Appium automation test foundation uiautomatorviewer positioning tool
Batch delete data in SQL - set in entity
Gin 入门实战
随机推荐
ROS学习(25)rviz plugin插件
初识MySQL
AcWing 345. 牛站 题解(floyd的性质、倍增)
AcWing 361. 观光奶牛 题解(spfa求正环)
字符串转成日期对象
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
C语言关于链表的代码看不懂?一篇文章让你拿捏二级指针并深入理解函数参数列表中传参的多种形式
ROS learning (21) robot slam function package -- installation and testing of orbslam
The difference between Tansig and logsig. Why does BP like to use Tansig
Baidu flying general BMN timing action positioning framework | data preparation and training guide (Part 1)
AcWing 1140. Shortest network (minimum spanning tree)
DS-5/RVDS4.0变量初始化错误
JS ES5也可以創建常量?
ROS learning (24) plugin
dvajs的基础介绍及使用
Scenario practice: quickly build wordpress blog system based on function calculation
Blue Bridge Cup 2022 13th provincial competition real topic - block painting
golang 基础 —— 数据类型
ROS learning (23) action communication mechanism
AcWing 1148. Secret milk transportation problem solution (minimum spanning tree)