Java HTML Encode toHtml(String str)

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

Description

to Html

License

Apache License

Declaration

public static String toHtml(String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String toHtml(String str) {
        return str.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace("'", "&apos;")
                .replace("\"", "&quot;").replace("(", "&#40;").replace(")", "&#41;").replace("[", "&#91;")
                .replace("]", "&#93;").replace("{", "&#123;").replace("|", "&#124;").replace("}", "&#125;")
                .replace("/", "&#47;").replace(",", "&#44;").replace("\\", "&#92;");
    }//  w w  w .  j  av a  2s .  co  m
}

Related

  1. toHTML(String rawText)
  2. toHTML(String s)
  3. toHtml(String s)
  4. toHtml(String str)
  5. toHtml(String str)
  6. toHtml(String str)
  7. toHTML(String string)
  8. toHTML(String text)
  9. toHtml(String text)