67,513
社区成员
发帖
与我相关
我的任务
分享
private static String htmlEncode(String text) {
if(text==null || "".equals(text))
return "";
text = text.replace("<", "<");
text = text.replace(">", ">");
text = text.replace(" ", " ");
text = text.replace("\"", """);
text = text.replace("\'", "'");
return text.replace("\n", "<br/>");
}
public static String textEncode(String text) {
if(text==null || "".equals(text))
return "";
text = text.replace("<", "<");
text = text.replace(">", ">");
text = text.replace(" ", " ");
text = text.replace(""", "\"");
text = text.replace("'", "\'");
return text.replace("<br/>", "\n");
}