I couldn't find a perfect title for the problem but here it comes..Is there a way in which a string "hello" can be changed into a 'hello' in java (android)?? This is to make my sql query work. For example, here's my function written in java for an android app
public Cursor GetLecture(String course_code)
{
SQLiteDatabase sqldb = this.getReadableDatabase();
String query = "SELECT * FROM Lecture WHERE course_code =" + course_code;
Cursor C = sqldb.rawQuery(query, null);
return C;
}
The problem here is that what the query needs is for the value of the course_code to be for instance 'S11'and not "S11" which the variable course_code has as it is a string..So how can I change the string value which has double quote ("") to single quote ('') to make the query work? Is there a shorter way or I have to change the whole algorithm?? Thanks in advance for considering!!