Android HTML Decode htmldecode(String str)

Here you can find the source of htmldecode(String str)

Description

htmldecode

Declaration

public static String htmldecode(String str) 

Method Source Code

//package com.java2s;

public class Main {
    public static String htmldecode(String str) {
        if (str == null) {
            return null;
        }/*w ww.j av  a2 s  .  co  m*/
        return replace("&quot;", "\"", replace("&lt;", "<", str));
    }

    public static String replace(String from, String to, String source) {
        if (source == null || source.length() == 0 || from == null
                || from.length() == 0 || to == null) {
            return source;
        }
        StringBuffer str = new StringBuffer("");
        int index = -1;
        int len = from.length();
        while ((index = source.indexOf(from)) != -1) {
            str.append(source.substring(0, index) + to);
            source = source.substring(index + len);
        }
        str.append(source);
        return str.toString();
    }
}

Related

  1. fromHtml(String str)
  2. getHrefInnerHtml(String href)