赞
踩
老用数据库,竟然忽略了,特殊字符的处理,记录下,加深下印象:
public static String sqliteEscape(String keyWord){
keyWord = keyWord.replace("/", "//");
keyWord = keyWord.replace("'", "''");
keyWord = keyWord.replace("[", "/[");
keyWord = keyWord.replace("]", "/]");
keyWord = keyWord.replace("%", "/%");
keyWord = keyWord.replace("&","/&");
keyWord = keyWord.replace("_", "/_");
keyWord = keyWord.replace("(", "/(");
keyWord = keyWord.replace(")", "/)");
return keyWord;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。