我正在使用以下代码使用jsoup解析内容.
try{
Elements divElements = jsDoc.getElementsByTag("div");
for(Element divElement : divElements){
if(divElement.attr("class").equals("article-content")){
textList.add(divElement.text());
text = textList.toString();
}
}
}
catch(Exception e){
System.out.println("Couldnt get content");
}
唯一的问题是内容返回括号围绕它[]那样.
我猜它是因为我设置的列表.我该如何删除这些?
更换:
text = textList.toString();
有:
text = textList.toString().replace("[", "").replace("]", "");
翻译自:https://stackoverflow.com/questions/7536154/remove-brackets-from-a-list-set-to-a-textview