Java Utililty Methods HTML Entities

List of utility methods to do HTML Entities

Description

The list of methods to do HTML Entities are organized into topic(s).

Method

StringhtmlEntites(String str)
html Entites
return str.replace("<", "&lt;").replace(">", "&gt;");
StringhtmlEntites(String str)
Replaces all opening an closing tags with < or >.
return str.replace("<", "&lt;").replace(">", "&gt;");
StringhtmlEntities(String s)
Escapes special html characters in a string, namely &, <, > and ".
s = s.replace("&", "&amp;");
s = s.replace("<", "&lt;");
s = s.replace(">", "&gt;");
s = s.replace("\"", "&quot;");
return s;
StringhtmlEntities(String text)
Converts the ampersand, quote, prime, less-than and greater-than characters to their corresponding HTML entities in the given string.
return text.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("'", "&prime;")
        .replaceAll("<", "&lt;").replaceAll(">", "&gt;");
StringhtmlEntityToString(String dataStr)
html Entity To String
int start = 0;
int end = 0;
StringBuffer buffer = new StringBuffer();
while (start > -1) {
    int system = 10;
    if (start == 0) {
        int t = dataStr.indexOf("&#");
        if (start != t)
...