Unicode 与 String字符串之间的相互转换
来源:互联网 发布:淘宝多少级能上直通车 编辑:程序博客网 时间:2024/05/25 21:36
public class U { public static String string2Unicode(String string) { if (string == null || string.isEmpty()) { return ""; } StringBuilder unicode = new StringBuilder(); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); unicode.append("\\u").append(Integer.toHexString(c)); } return unicode.toString(); } public static String unicode2String(String unicode) { if (unicode == null || unicode.isEmpty()) { return ""; } StringBuilder string = new StringBuilder(); String[] hex = unicode.split("\\\\u"); for (int i = 1; i < hex.length; i++) { int data = Integer.parseInt(hex[i], 16); string.append((char) data); } return string.toString(); }}
阅读全文
0 0
- Unicode 与 String字符串之间的相互转换
- unicode与string之间的相互转换
- Unicode下的CString与String之间的相互转换
- Unicode下的CString与String之间的相互转换
- Java 字符串与Unicode之间的相互转换
- 字符串string与char*之间的相互转换
- String字符串与整数之间的相互转换
- Unicode与String相互转换
- char *与string之间的相互转换
- int 与String 之间的相互转换
- pb字符串实现GB2312与Unicode、UTF8之间的相互转换
- utf,unicode,ascii字符串之间的相互转换
- ANSI,UNICODE, UTF-8 字符串之间的相互转换
- ANSI,UNICODE, UTF-8 字符串之间的相互转换
- asii和unicode格式字符串之间的相互转换
- Unicode字符串与Unicode数据的相互转换
- 字符串与数值之间的相互转换
- time_t 与字符串之间的相互转换
- 关于spring AOP 的初步学习
- 并查集
- Ubuntu 16.04 Exception: tostring() has been removed. Please call tobytes() instead.
- MySQL高可用方案选型参考
- 洛谷 P1018 乘积最大(NOIp2000提高组第二题)
- Unicode 与 String字符串之间的相互转换
- gridview、listview适配器布局中带有checkbox实现的列表 checkbox只能有一项选中
- windows网络编程(三)——UDP
- Centos下ftp的搭建
- redis windows下的环境搭建
- 欧姆龙PLC连接WINCC通讯
- java实现打印功能
- JSP中include指令和include动作的区别
- 排序问题