Java HTML Encode toHTMLEncode(String string)

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

Description

to HTML Encode

License

Apache License

Declaration

public static String toHTMLEncode(String string) 

Method Source Code

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

public class Main {
    /***********************************************************************/
    public static String toHTMLEncode(String string) {
        if (string == null) {
            return null;
        }//from www .  j  a  v  a2 s. c o m
        string = string.replaceAll("<", "&lt;");
        string = string.replaceAll("\n", "<br />");
        return string;
    }
}

Related

  1. toHtml(String value, String defaultValue)
  2. toHTML(String xhtml)
  3. toHtmlChars(String htmlReady)
  4. toHTMLContentString(String s, boolean replaceSpaces, boolean isXhtml)
  5. toHtmlCR(String text)
  6. toHTMLEscapedText(String s)
  7. toHtmlInput(String str)
  8. toHtmlLine(String input)
  9. toHTMLString(String in)