On 15 Dec 2009, at 23:13, Jim Turner wrote:

> I believe you need the diacritic insensitive option:
> 
> 'someProperty BEGINSWITH[d] "ก"'

Well, no. BEGINSWITH[d] tells me that "กิน" begins with "กุ" - that is: it 
ignores not only the tone-marks, but also some vowels, which makes it quite 
unusable for Thai text.

MATCHES can be used (it seems to act like NSLiteralSearch) but it is quite slow.
> 
> Look up NSComparisonPredicate options in the documentation for more
> discussion.  

NSComparisonPredicate Class Reference mentions under "NSComparisonPredicate 
Options" the [n] modifier.

I just tried it: BEGINSWITH[n] finds that "กิน" begins with "ก" - same as 
NSLiteralSearch.
But CONTAINS[n] does not work like NSLiteralSearch.

> As for what the 'w' means, it's Spotlight specific.  "The
> Comparison is word based, and also detects transitions from lower-case
> to upper-case."
> 
> http://developer.apple.com/Mac/library/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/QueryFormat.html
> 

Somehow I have the feeling that the documention for NSPredicates has some room 
for improvements.

Thanks very much for your links!

Gerriet.


> -- 
> Jim
> http://nukethemfromorbit.com
> 
> 
> 
> On Tue, Dec 15, 2009 at 1:30 AM, Gerriet M. Denkmann
> <gerr...@mdenkmann.de> wrote:
>> 
>> This works. i.e. returns {0,1}:
>> NSRange r2 = [ @"ก่ี" rangeOfString: @"ก" options: NSAnchoredSearch | 
>> NSLiteralSearch ];
>> (without NSLiteralSearch it returns NSNotFound).
>> 
>> but an NSPredicate with: "someProperty BEGINSWITH "ก" " does NOT find ก่ี".
>> (the NSPredicate is to be used with -[NSArrayController setFilterPredicate:] 
>> to query Core Data).
>> 
>> So: is there some string_option equivalent to NSLiteralSearch?
>> 
>> And a related question: where are the available string_options defined?
>> The Predicate Programming Guide has:
>> string_options ::= c | d | cd
>> 
>> but also an example with "w":
>> ((* = "FooBar*"wcd)) || (kMDItemTextContent = "FooBar*"cd))
>> 
>> 10.6.2

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to