I am facing strange issue i am getting string from database and comparing with a string, but when i compare them with equals operator they do not come equal.
String1 = Love is a game that two can play and both win.
String2 = Love is a game that two can play and both win.
Cursor data = database2.query("Quote", fields, null, null, null, null, null);
data.moveToFirst();
for(int i = 0; i < data.getCount() ; i++){
if(data.getString(2).trim().equals(_qt2.trim())){
Log.i("Found Matching quote", "");
data.moveToPosition(i);
}
}
This is the log:
E/Data 2(8818): Love is a game that two can play and both win.
E/Data 3(8818): Love is a game that two can play and both win.
Thanks
Use trim(), ignorecase and contains (if your scenario supports it)