Java HTML Unescape unEscapeHTML(final String escapedHTML)

Here you can find the source of unEscapeHTML(final String escapedHTML)

Description

Replace HTML escape sequences with the correct characters

License

Open Source License

Parameter

Parameter Description
escapedHTML The original string

Return

The result, after substitution

Declaration

public static String unEscapeHTML(final String escapedHTML) 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by

public class Main {
    /**//from   w  ww . j  a  v  a  2s.c o  m
     * Replace HTML escape sequences with the correct characters
     *
     * @param escapedHTML The original string
     * @return The result, after substitution
     */
    public static String unEscapeHTML(final String escapedHTML) {
        String retVal = escapedHTML;

        retVal = retVal.replaceAll(">", ">");
        retVal = retVal.replaceAll("&lt;", "<");
        retVal = retVal.replaceAll("&amp;", "&");
        retVal = retVal.replaceAll("&nbsp;", " ");

        return retVal;
    }
}

Related

  1. htmlUnescape(String s)
  2. htmlUnescape(String source)
  3. unescapeHtml(final String input)
  4. unescapeHTML(String comment)
  5. unescapeHTML(String html)
  6. unescapeHtml(String s)