package com.geostar.geosmarter;
public class Test03 {
public static void main(String[] args) {
String aa = "/的模型//";
System.out.println(unicode2String(aa));
}
public static String unicode2String(String unicode) {
StringBuffer string = new StringBuffer();
if (unicode.startsWith("&#x")) {
String[] hex = unicode.replace("&#x", "").split(";");
for (int i = 0; i < hex.length; i++) {
int data = Integer.parseInt(hex[i], 16);
string.append((char) data);
}
}else if(unicode.startsWith("&#")){
String[] hex = unicode.replace("&#", "").split(";");
for (int i = 0; i < hex.length; i++) {
int data = Integer.parseInt(hex[i], 10);
string.append((char) data);
}
}
return string.toString();
}
}