我正在使用以下代码和 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("]", "");
关于java - 从设置为 TextView 的列表中删除方括号 []?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7536154/