67,512
社区成员
发帖
与我相关
我的任务
分享
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class UnicodeGbk {
public static void main(String[] args)
{
String a = "#35780#26631#19987#23478#30005#23376#35821#38899#36890";
Pattern p = Pattern.compile("#\\d*");
Matcher m = p.matcher(a);
boolean rs = m.find();
while (rs) {
String aa = m.group();
String str = aa.replaceAll("#", ",").replaceAll(";", "");
String[] s2 = str.split(",");
String s1 = "";
for (int i = 1; i < s2.length; i++) {
int v = Integer.parseInt(s2[i], 10);
s1 = s1 + (char) v;
//System.out.println((char)v);
a = a.replaceFirst(aa, s1);
}
rs = m.find();
}
System.out.println(a);
}
}