我有以下代码:
public class NewClass {
public String noTags(String str){
return Jsoup.parse(str).text();
}
public static void main(String args[]) {
String strings=""-//W3C//DTD HTML 4.0 Transitional//EN \">" +
"
hello world
yo googlez
";NewClass text = new NewClass();
System.out.println((text.noTags(strings)));
}
结果是:
hello world yo googlez
但我想打破界限:
hello world
yo googlez
我已经看过jsoup的TextNode#getWholeText(),但是我不知道如何使用它。
如果
我解析的标记中有一个,如何在结果输出中换行?