0

I've added search to my code and now am I wondering about one thing.

I'm using Parse.com's method:

query.whereContains("my_strings_from_Parse", text_from_EditText.toLowerCase())

I've made the text from EditText to lower-case bur right now do i need to make the strings from Parse.com lower-case.

Do you have any idea how to do it?

Intent intent = getIntent();
        String query = intent.getStringExtra("query");
ParseQuery<Animal> squery = ParseQuery.getQuery(Animal.class);
squery.whereContains("animal", query.toLowerCase()); //I need to make content of                                                                                                                                                                                                           //"animal"

marson
  • 913
  • 10
  • 32

1 Answers1

3

You can use a regex with the case insensitive modifier, like stated here:

public ParseQuery<T> whereMatches(String key, String regex, String modifiers)

Add a regular expression constraint for finding string values that match the provided regular expression. This may be slow for large datasets.

Parameters:

key - The key that the string to match is stored in.
regex - The regular expression pattern to match.
modifiers - Any of the following supported PCRE modifiers:
    i - Case insensitive search
    m - Search across multiple lines of input

Returns: Returns the query, so you can chain this call.

a.bertucci
  • 12,142
  • 2
  • 31
  • 32
  • 2
    or go onto parse.com and cleanse your data. i.e query the data (from the webapp), change it all to lowercase and update all your rows. (This is a one time cleanse; if you are using 3rd party data that updates on it's own you will need @a.bertucci's solution) – Blundell Feb 09 '14 at 15:21
  • Thank you both for helpful answers. Now am I trying the suggestion by a.bertuci. Question: how sould i define the last field when i want to use "i"? After that will i also try @Blundell 's answer and find out, what is batter. Thanks again :) – marson Feb 10 '14 at 20:45
  • Sorry for spamming, but ive figured it out. just used "i" of course, not i only. Thanks a lot – marson Feb 10 '14 at 20:47