Java HTML Unescape unescapeHTML(String value)

Here you can find the source of unescapeHTML(String value)

Description

unescape HTML

License

Open Source License

Declaration

public static String unescapeHTML(String value) 

Method Source Code

//package com.java2s;
// Released under the terms of the CPL Common Public License version 1.0.

public class Main {
    private static final String[] specialHtmlChars = new String[] { "&", "<", ">" };
    private static final String[] specialHtmlEscapes = new String[] { "&amp;", "&lt;", "&gt;" };

    public static String unescapeHTML(String value) {
        return replaceStrings(value, specialHtmlEscapes, specialHtmlChars);
    }//  ww  w.  j  a v  a2 s.c o  m

    private static String replaceStrings(String value, String[] originalStrings, String[] replacementStrings) {
        String result = value;
        for (int i = 0; i < originalStrings.length; i++)
            if (result.contains(originalStrings[i]))
                result = result.replace(originalStrings[i], replacementStrings[i]);
        return result;
    }
}

Related

  1. unescapeHTML(String source)
  2. unescapeHTML(String source, int start)
  3. unescapeHTML(String str)
  4. unEscapeHtml(String text)
  5. unescapeHTML(String value)
  6. unescapeHTML2(String source, int start)
  7. unescapeHtmlByName(final String input)
  8. unescapeHtmlByNumber(final String input)
  9. unEscapeHTMLTag(String input)