獲取一段html的內容簡介

    /**
     * 內容簡介
     * 
     * @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 "";
        }
    }.net

相關文章
相關標籤/搜索