what does ios dev NSPredicate "title CONTAIN[c]". the [c] mean?

In iOS development, the NSPredicate expression title CONTAIN[c] is used to filter objects based on a specific property. In this case, the property being filtered is title.

The CONTAIN[c] operator is a case-insensitive comparison operator. It means that the predicate will match objects where the title property contains the specified string, regardless of whether the characters are in uppercase or lowercase.

Here's a breakdown of what each part means:

title: This is the name of the property that will be compared.
CONTAIN: This is the comparison operator, which checks if the specified string is contained within the property value.
[c]: This modifier indicates that the comparison should be case-insensitive.
For example, if you have an array of objects with a title property, and you want to find all objects where the title contains the string "apple", you could use the following NSPredicate:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"title CONTAINS[c] %@", @"apple"];
NSArray *filteredArray = [myArray filteredArrayUsingPredicate:predicate];

This would return a new array containing only the objects whose title property contains the string "apple", regardless of whether it's written as "apple", "Apple", or "APPLE".

Get New Tutorials by Email

No spam. Just clear, practical breakdowns you can apply right away.

Enjoy this tutorial?

Get new practical tech tutorials in your inbox.