完美处理unicode码与其他字符串混合的字符串
来源:互联网 发布:宁波院士之乡 知乎 编辑:程序博客网 时间:2024/06/05 03:51
完美处理unicode码与其他字符串混合的字符串
方法一:
- public static String decode(String unicodeStr) {
- if (unicodeStr == null) {
- return null;
- }
- StringBuffer retBuf = new StringBuffer();
- int maxLoop = unicodeStr.length();
- for (int i = 0; i < maxLoop; i++) {
- if (unicodeStr.charAt(i) == '\\') {
- if ((i < maxLoop - 5)
- && ((unicodeStr.charAt(i + 1) == 'u') || (unicodeStr
- .charAt(i + 1) == 'U')))
- try {
- retBuf.append((char) Integer.parseInt(
- unicodeStr.substring(i + 2, i + 6), 16));
- i += 5;
- } catch (NumberFormatException localNumberFormatException) {
- retBuf.append(unicodeStr.charAt(i));
- }
- else
- retBuf.append(unicodeStr.charAt(i));
- } else {
- retBuf.append(unicodeStr.charAt(i));
- }
- }
- return retBuf.toString();
- }
- 完美处理unicode码与其他字符串混合的字符串
- 字符串与其他类型的互转换
- 十六进制字符串与其他类型的转换
- 字符串类型与其他数据类型的转换
- 字符串数据类型与其他类型之间的转换
- 数据类型转字符串及CString与其他数据类型的转换
- 总结String类字符串与其他类型的转换
- 字符串常量与字符串变量 字符串与其他数据类型的任意转换
- 字符串类型与其他类型转换
- 字符串与其他类型相互转化
- socket 发送十六进制的字符串(十六进制字符串与其他类型的转换)(转)
- socket发送十六进制字符串 (十六进制字符串与其他类型的转换)
- socket发送十六进制字符串 (十六进制字符串与其他类型的转换)
- socket发送十六进制字符串 (十六进制字符串与其他类型的转换)
- Unicode和字符串处理
- Oracle截取中英文混合字符串的处理
- VC中Unicode字符串的处理
- 转贴]VC中Unicode字符串的处理
- WordPress插件机制实现原理
- scrollTo 以及 scrollBy方法使用说明
- 【文件】CString类字符串序列化分析
- C++ Date Structure 3
- SQL Sever 2000/2005/2008下载地址集合
- 完美处理unicode码与其他字符串混合的字符串
- Ubuntu11.10设置桌面启动器(桌面快捷方式)
- android sdk platforms 无法下载安装
- poj 3281 Dinicing
- Oracle Rman 命令详解(List report backup configure)
- JSF入门、简单示例
- HTML5画布更广泛的KineticJS函数
- Oracle 快照控制文件(snapshot control file)
- 程序员的职业规划(读的蛮有感觉的)