获取一段html的内容简介
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
?? ?/**
?? ? * 內(nèi)容簡(jiǎn)介
?? ? *?
?? ? * @return
?? ? */
?? ?public String getDesc() {
?? ??? ?if (StringUtils.isNotBlank(content) == true) {
?? ??? ??? ?String txt = Jsoup.parse(content).text();
?? ??? ??? ?if (StringUtils.isNotBlank(txt) == true) {
?? ??? ??? ??? ?if (txt.length() > 100) {
?? ??? ??? ??? ??? ?txt = txt.substring(0, 100);
?? ??? ??? ??? ?}
?? ??? ??? ??? ?txt = StringEscapeUtils.escapeHtml3(txt);
?? ??? ??? ?}
?? ??? ??? ?return txt;
?? ??? ?} else {
?? ??? ??? ?return "";
?? ??? ?}
?? ?}
轉(zhuǎn)載于:https://my.oschina.net/u/1045177/blog/1031520
總結(jié)
以上是生活随笔為你收集整理的获取一段html的内容简介的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oracle 10g/11g 命令对照
- 下一篇: Linux时间子系统之二:表示时间的单位