Java HTML to String htmlToString(String string)

Here you can find the source of htmlToString(String string)

Description

html To String

License

Open Source License

Declaration

public static String htmlToString(String string) 

Method Source Code

//package com.java2s;
/*/*from www .  ja va  2 s  .  c  o  m*/
 * Copyright (c) 2008, 2009, 2010, 2011 Denis Tulskiy
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with this work.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    public static String htmlToString(String string) {
        String ans = string.replaceAll("&quot;", "\"");
        ans = ans.replaceAll("&amp;", "&");
        ans = ans.replaceAll("&lt;", "<");
        ans = ans.replaceAll("&gt;", ">");
        ans = ans.replaceAll("<.+?>", "");

        return ans;
    }
}

Related

  1. html2Plain(String text)
  2. html2Text(String html)
  3. htmlToStr(String htmlStr, int max_count)
  4. htmlToString(String aS_Text)
  5. htmlToString(String s)
  6. htmlToText(String html)
  7. htmlToText(String html)
  8. htmlToText(String input)
  9. htmlToText(String sHTML)