我从请求中得到这个:
在演播室里,日耳曼人,哈伊,苏贝尔,达菲,达利,指责我。E非独奏le sue...<\/p>\r\n\t\t\t03\/11\/2017<\/date>\r\n\t\t<\/div>\r\n\t\t
但我只需要得到这个:
在演播室里,日耳曼人,哈伊,苏贝尔,达菲,达利,指责我。我不能单独起诉..。
这是我的密码:
try {
// Connect to the web site
Document document = Jsoup.connect("http://myapi.com").ignoreContentType(true).get();
Elements img = document.select("p");
for (int i = 0; i < img.size(); i++) {
imgSrc = img.get(i);
imgSrc2 = String.valueOf(imgSrc.text());
System.out.println("resultTITLE:" + imgSrc2);
}
} catch (IOException e) {
e.printStackTrace();
}我该怎么做?我是新来的。
发布于 2017-11-06 13:22:06
你应该试试下面的代码:-
@SuppressWarnings("deprecation")
public static Spanned fromHtml(String html){
Spanned result;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
result = Html.fromHtml(html,Html.FROM_HTML_MODE_LEGACY);
} else {
result = Html.fromHtml(html);
}
return result;
}https://stackoverflow.com/questions/47137912
复制相似问题