Example usage for org.apache.commons.lang3 StringEscapeUtils unescapeHtml3

List of usage examples for org.apache.commons.lang3 StringEscapeUtils unescapeHtml3

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringEscapeUtils unescapeHtml3.

Prototype

public static final String unescapeHtml3(final String input) 

Source Link

Document

Unescapes a string containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes.

Usage

From source file:org.sakaiproject.qna.logic.impl.NotificationLogicImpl.java

/**
 * Strip tags from html Copy of TextUtil method in tool
 *///from  w w w.  j  a  v  a 2  s.c o m
private String stripTags(String html) {
    return StringEscapeUtils.unescapeHtml3(html.replaceAll("\\<.*?>", "").replaceAll("&nbsp;", " "));
}

From source file:org.sakaiproject.qna.utils.TextUtil.java

/**
 * Strips all HTML tags from string/*from ww w.  ja  va  2  s  .co  m*/
 * 
 * @param String with html tags
 * @return String without tags
 */
public static String stripTags(String html) {
    String cleanup = QNAUtils.cleanupHtmlPtags(html);
    return StringEscapeUtils.unescapeHtml3(cleanup.replaceAll("\\<.*?>", "").replaceAll("&nbsp;", " "));

    //return cleanup.replaceAll("\\<.*?>","").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&nbsp;", " ").replaceAll("&amp;", "&");
}