特殊字符 转义对照。如 < >
一般是html的转义,xml也适用
但是在写sql时,xml文件中会出现。
转义方法
public static String htmlReplace(String str){ str = str.replace("“","“"); str = str.replace("”","”"); str = str.replace(" ","”"); str = str.replace("&","&"); str = str.replace("'","'"); str = str.replace("’","’"); str = str.replace("—","—"); str = str.replace("–","–"); str = str.replace("<","<"); str = str.replace(">",">"); return str; }
下班记得打卡