unescape Unicode - Android java.lang

Android examples for java.lang:String Unicode

Description

unescape Unicode

Demo Code


public class Main{

    public static String unescapeUnicode(String str) {
        StringBuffer b = new StringBuffer();
        Matcher m = Pattern.compile("\\\\u([0-9a-fA-F]{4})").matcher(str);
        while (m.find())
            b.append((char) Integer.parseInt(m.group(1), 16));
        return b.toString();
    }/*w w w  .j av  a  2s. com*/

}

Related Tutorials