Android examples for java.lang:String Escape
escape SQL string
public class Main { public static String escapeSql(String str) { // ' --> '' str = str.replaceAll("'", "''"); // " --> "" str = str.replaceAll("\"", "\"\""); // \ --> (remove backslashes) str = str.replaceAll("\\\\", ""); return str;//from w w w. j ava 2 s. c om } }