Java tutorial
//package com.java2s; import android.database.DatabaseUtils; public class Main { public static String sanitizeString(String str) { if (!isNullOrEmpty(str)) { str = DatabaseUtils.sqlEscapeString(str); str = str.replaceAll("'", ""); str = str.replaceAll("\"", ""); } return str; } public static boolean isNullOrEmpty(String str) { if (str == null || str.trim().equals("")) { return true; } return false; } }