For special escape characters of sqlite, select * fromtablewherenumberlike % escape... some special characters need to be escaped when the sqlite3 database is searching. The specific escape is as follows:
Special Character escape for sqlite select * fromtablewhere number like %/% escape /... when the sqlite3 database is searching, some special characters need to be escaped. The specific escape is as follows: /-//-[-/[]-/] %-/_ (-/()-/) www.2cto.com note that special words
Special Character escape for sqlite
Select * fromtablewhere number like '%/%' escape '/'...
When the sqlite3 database is searching, some special characters need to be escaped. The specific escape is as follows:
/-> //
'->''
[-> /[
]->/]
%->/%
&-> /&
_-> /_
(-> /(
)-> /)
Www.2cto.com
Note that special characters do not use the Backslash "\" to indicate escape characters.
01
Public static String sqliteEscape (String keyWord ){
02
KeyWord = keyWord. replace ("/","//");
03
KeyWord = keyWord. replace ("'","''");
04
KeyWord = keyWord. replace ("[","/[");
05
KeyWord = keyWord. replace ("]", "/]");
06
KeyWord = keyWord. replace ("%", "/% ");
07
KeyWord = keyWord. replace ("&","/&");
08
KeyWord = keyWord. replace ("_","/_");
09
KeyWord = keyWord. replace ("(","/(");
10
KeyWord = keyWord. replace (")","/)");
11
Return keyWord;
12
}