List of utility methods to do HTML Decode
String | htmldecode(String str) htmldecode if (str == null) { return null; return replace(""", "\"", replace("<", "<", str)); |
Spanned | fromHtml(String str) from Html if (!isEmpty(str)) { return Html.fromHtml(str); } else return Html.fromHtml(""); |
String | getHrefInnerHtml(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()) { ... |