Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to Parse Query search case insensitive in android?

I am using the parse cloud to store data . in this case I have a table "MyUser" in this table I want to search user by name in case insensitive.

Search is working fine but the search operation is not case insensitive

I have to search case insensitive

here is my code.:-

ParseQuery<ParseObject> query = ParseQuery.getQuery("BetsUpUser");
query.whereContains("name", searchData);
query.findInBackground(new FindCallback<ParseObject>() {
     public void done(List<ParseObject> objList,ParseException e) {
       if (e == null) {
          Log.d("score","@@@@Retrieved " + objList.size()+ " scores");

       } else {
          Log.d("score", "@@@Error: " + e.getMessage());
       }
    }
});

Thanks in advance.

like image 960
SAndroidD Avatar asked Jun 25 '14 05:06

SAndroidD


1 Answers

I Solve the problem of case insensitive string Parse Query

replace the line

query.whereContains("name", searchData);

with

query.whereMatches("name", "("+searchData+")", "i"); 
like image 80
SAndroidD Avatar answered Sep 26 '22 10:09

SAndroidD