I am searching in sqlite database by a editext input. In the sqlite I have some sentence. I want to find the sentences from sqlite which there is in them some words which start by my input text. For example if my input text be: 'harm' I want to find the sentences which have words like 'harmful'. I don't want to find 'harmful' word when input search was 'ful'. Because this word isn't in the start of my word(harmful). Hope to get my purpose. Here is my example code:
String pattern = "'%" + inputSearch.getText().toString() + "%'";
final String sql = "SELECT * FROM " + TABLE + " WHERE " + TITLE + " LIKE " + pattern;
final SQLiteDatabase mydb = new MyDatabase(ArdicActivity.this).getWritableDatabase();
// final Cursor c = mydb.rawQuery(sql, null);
I want to find the word between sentence. For example I want to find the 'harmful' word from sentence: 'this food is hurmful for you'