jeudi 17 décembre 2015

How to replace a specific character inside sqlite command without replacing the character outside the command

I have an sqlite command:

_db.execSQL("INSERT INTO " + DATABASE_TABLE + " (Remarks, studentnum, regno, book)" + " VALUES ('This is a "sample" sentence ', 1, 1, 'book1');");

i just want to find and replace the quotes inside the values, from "sample" to \"sample\" but when i do, the quotes outside the parentheses is also changed, is there any other way that i can do these with condition? another example is i want to eliminate the single quotes inside the values from (') to ('') but i need some single quotes to stay,i have hundreds of commands like these so it would be very helpful.

Aucun commentaire:

Enregistrer un commentaire