카테고리 없음

문자변환

yhlee 2013. 11. 16. 19:08
private static final Pattern p = Pattern.compile("\\\\u([0-9A-F]{4})");
public static String U2U(String s) {
	String res = s;
	Matcher m = p.matcher(res);
	
	while(m.find()) {
		res = res.replaceAll("\\" + m.group(0),
		Character.toString((char)Integer.parseInt(m.group(1), 16)));
	}
	return res;
}