One option is to subclass NSManagedObject
and provide a (readonly) property that returns the contents of the property in question as an array instead of a comma separated list. NSString
has a -componentsSeparatedByString:
method that makes it easy to create such an array.
Another option is to create a predicate that accepts any object that contains the search string in the property in question, and then filter the matching objects to weed out any false positives.
A third possibility is to make sure that the target property always has a comma as the very first character, and then prepend a comma to the search string when you create the predicate. That is, sore a value like ,abc,and,abn
instead of abc,and,abn
, and then search for ,ab
instead of ab
.
That said, I think the right solution is to avoid the situation altogether by storing the values as a set rather than as a comma separated list.