Java tutorial
//package com.java2s; import android.database.DatabaseUtils; public class Main { private static String sqlEscapeString(String aString) { String aReturn = ""; if (null != aString) { //aReturn = aString.replace("'", "''"); aReturn = DatabaseUtils.sqlEscapeString(aString); // Remove the enclosing single quotes ... aReturn = aReturn.substring(1, aReturn.length() - 1); } return aReturn; } }