Java HTML to String htmlToText(String sHTML)

Here you can find the source of htmlToText(String sHTML)

Description

html To Text

License

Open Source License

Declaration

public static String htmlToText(String sHTML) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String htmlToText(String sHTML) {
        String sText = "";
        if (sHTML != null) {
            int i = 0;
            while (i < sHTML.length()) {
                char c = sHTML.charAt(i);
                switch (c) {
                case '<':
                    i++;/*from  ww  w.  j ava 2s  .  c  o  m*/
                    int iEndTag = sHTML.indexOf(">", i);
                    String sTagName = sHTML.substring(i, iEndTag);
                    if (!sTagName.startsWith("/")) {

                    }
                    i = iEndTag + 1;
                    break;
                //case '\'' | '\"':
                //   sText += "\\"+c;
                //   i++;   
                //   break;
                default:
                    sText += c;
                    i++;
                    break;
                }
            }
        }
        return sText;
    }
}

Related

  1. htmlToString(String s)
  2. htmlToString(String string)
  3. htmlToText(String html)
  4. htmlToText(String html)
  5. htmlToText(String input)
  6. toText(String html)
  7. toText(String html)
  8. toText(String text)
  9. toTextareaInput(String str)