Android Utililty Methods HTML Decode

List of utility methods to do HTML Decode

Description

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

Method

Stringhtmldecode(String str)
htmldecode
if (str == null) {
    return null;
return replace("&quot;", "\"", replace("&lt;", "<", str));
SpannedfromHtml(String str)
from Html
if (!isEmpty(str)) {
    return Html.fromHtml(str);
} else
    return Html.fromHtml("");
StringgetHrefInnerHtml(String href)
get innerHtml from href
 getHrefInnerHtml(null)                                  = "" getHrefInnerHtml("")                                    = "" getHrefInnerHtml("mp3")                                 = "mp3"; getHrefInnerHtml("<a innerHtml</a>")                    = "<a innerHtml</a>"; getHrefInnerHtml("<a>innerHtml</a>")                    = "innerHtml"; getHrefInnerHtml("<a<a>innerHtml</a>")                    = "innerHtml"; getHrefInnerHtml("<a href="baidu.com">innerHtml</a>")               = "innerHtml"; getHrefInnerHtml("<a href="baidu.com" title="baidu">innerHtml</a>") = "innerHtml"; getHrefInnerHtml("   <a>innerHtml</a>  ")                           = "innerHtml"; getHrefInnerHtml("<a>innerHtml</a></a>")                      = "innerHtml"; getHrefInnerHtml("jack<a>innerHtml</a></a>")                  = "innerHtml"; getHrefInnerHtml("<a>innerHtml1</a><a>innerHtml2</a>")        = "innerHtml2"; 
if (isEmpty(href)) {
    return "";
String hrefReg = ".*<[\\s]*a[\\s]*.*>(.+?)<[\\s]*/a[\\s]*>.*";
Pattern hrefPattern = Pattern.compile(hrefReg,
        Pattern.CASE_INSENSITIVE);
Matcher hrefMatcher = hrefPattern.matcher(href);
if (hrefMatcher.matches()) {
...