问问题
9012 次
2 回答
4
You can't have any specific method from API to do this. Use the below method.
String text="Federation of AP Chambers of Commerce & Industry Awards for the year 2010-11. Speaking on the occasion,
He said, "About 54 percent of the population is youth aged below 25 years. We have to use their energy and
intelligence for development of the state as well as the country.The youth trained will also be absorbed by
companies.’"";
text= replaceAll(text,""","\"");
text= replaceAll(text,"&","&");
text= replaceAll(text,"’","’");
private String replaceAll(String source, String pattern, String replacement) {
if (source == null) {
return "";
}
StringBuffer sb = new StringBuffer();
int index;
int patIndex = 0;
while ((index = source.indexOf(pattern, patIndex)) != -1) {
sb.append(source.substring(patIndex, index));
sb.append(replacement);
patIndex = index + pattern.length();
}
sb.append(source.substring(patIndex));
return sb.toString();
}
于 2012-08-07T11:33:27.813 回答
3
It looks like the Jakarta Commons Lang library's StringEscapeUtils.unescapeHtml() method will do what you are looking for.
于 2012-07-27T05:36:11.333 回答