Java tutorial
//package com.java2s; //License from project: Apache License import android.util.*; import java.util.regex.*; public class Main { private static final Pattern CHAR_CODE_PATTERN = Pattern.compile("&#(\\d{2,5});"); public static String fixCharCode(String wholeFile) { long millis = System.currentTimeMillis(); Matcher mat = CHAR_CODE_PATTERN.matcher(wholeFile); StringBuffer sb = new StringBuffer(); while (mat.find()) { // System.gc(); mat.appendReplacement(sb, ((char) Integer.parseInt(mat.group(1)) + "")); } mat.appendTail(sb); Log.d("fix char code time: ", "" + (System.currentTimeMillis() - millis)); return sb.toString(); } }