Java HTML Encode htmlspecialchars(String str)

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

Description

htmlspecialchars

License

Apache License

Declaration

public static String htmlspecialchars(String str) 

Method Source Code

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

public class Main {
    public static String htmlspecialchars(String str) {
        str = str.replaceAll("&", "&");
        str = str.replaceAll("<", "&lt;");
        str = str.replaceAll(">", "&gt;");
        str = str.replaceAll("\"", "&quot;");
        return str;
    }/*w ww .  jav  a2 s . com*/
}

Related

  1. htmlize(StringBuffer sb)
  2. htmlSpecialChars(String handleStr)
  3. htmlSpecialChars(String html)
  4. htmlspecialchars(String input)
  5. htmlspecialchars(String s)
  6. textToHtml(final String s)
  7. textToHtml(String html)
  8. textToHTML(String message)
  9. textToHtml(String s)