質問する
9012 次
2 に答える
4
これを行うために API から特定のメソッドを使用することはできません。以下の方法を使用します。
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 に答える