public static String encodeHTML(String str)
{
if ((str == null) || (str.length() == 0))
{
return "";
}
str = str.replaceAll("&", "&");
str = str.replaceAll("<", "<");
str = str.replaceAll(">", ">");
str = str.replaceAll("\"", """);
str = str.replaceAll("'", "'");
str = str.replaceAll("\\(", "(");
str = str.replaceAll("\\)", ")");
str = str.replaceAll("%", "%");
str = str.replaceAll("\\+", "+");
str = str.replaceAll("-", "-");
return str;
}
escape html
最新推荐文章于 2022-07-25 11:33:23 发布