a
554325746@qq.com
2020-01-02 e52632329ef8342a2f692bf58184fc54db3d2b4c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.basic.security.utils;
 
public class UnicodeUtil {
 
    public static void main(String[] args) {
        System.out.println(unicodeArrayToString("[24464,20462,28330]"));
    }
 
    public static String unicodeArrayToString(String unicodeArray) {
        try {
            if (unicodeArray == null) {
                return "";
            }
            if (unicodeArray.startsWith("[") && unicodeArray.endsWith("]")) {
                unicodeArray = unicodeArray.substring(1);
                unicodeArray = unicodeArray.substring(0, unicodeArray.length() - 1);
                String[] split = unicodeArray.split(",");
                String str = "";
                for (int i = 0; i < split.length; i++) {
                    str += Character.toString((char) Integer.parseInt(split[i]));
                }
                return str;
            }
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
        return unicodeArray;
    }
 
}