I have to decode, using Java, HTML strings which contain the following entities: "'" and "&apos". I'm using Apache Commons Lang, but it doesn't decode those two entities, so, I'm currently doing as follows, but I'm looking for the fastest way to do what I want.
import org.apache.commons.lang.StringEscapeUtils;
public class StringUtil {
public static String decodeHTMLString(String s) {
return StringEscapeUtils.unescapeHtml((s.replace("'", "`").replace("'", "'")));
}
}
I searched for older questions, but none seems to answer my question.