FROM : Nicko van Someren
DATE : Wed Oct 06 20:50:57 2004
On 6 Oct 2004, at 19:30, Chuck Soper wrote:
> I'm interested in your question.
>
> I searched for: NSString locale at: http://www.cocoabuilder.com
>
> and found this:
> http://www.cocoabuilder.com/archive/message/2002/2/8/14734
>
> The answer to your question is unclear to me, but the email does say,
> "comparison only done with respect to the user's preferred locale".
> Perhaps, the localizedCompare: method will work properly if the
> strings are initialized with initWithFormat:locale:.
Thanks for the pointer. In the case in hand passing the dictionary:
[[NSUserDefault standardUserDefaults] dictionaryRepresentation]
as suggested seems to do what I need. The implication of the posting
you mention is that in fact no matter what dictionary I pass as the
locale, if something it will sort on the user's default locale. I'll
continue to pass the standard user defaults dictionary none the less so
that my code still works if Apple ever properly implement the feature.
Nicko
> At 5:35 PM +0100 10/6/04, Nicko van Someren wrote:
>> The documentation for NSString's localizedCompare: says "Performs a
>> localized compare between the receiver and string. See Also: -
>> compare:options:range:locale:". Presumably it is simply calling
>> compare:options:range:locale: with some predefined values for
>> options, an empty range and a "local" locale. My question is where
>> does that locale come from? I want to do a localised search with the
>> NSNumericSearch option switched on, so I need to pass in the same
>> locale information.
DATE : Wed Oct 06 20:50:57 2004
On 6 Oct 2004, at 19:30, Chuck Soper wrote:
> I'm interested in your question.
>
> I searched for: NSString locale at: http://www.cocoabuilder.com
>
> and found this:
> http://www.cocoabuilder.com/archive/message/2002/2/8/14734
>
> The answer to your question is unclear to me, but the email does say,
> "comparison only done with respect to the user's preferred locale".
> Perhaps, the localizedCompare: method will work properly if the
> strings are initialized with initWithFormat:locale:.
Thanks for the pointer. In the case in hand passing the dictionary:
[[NSUserDefault standardUserDefaults] dictionaryRepresentation]
as suggested seems to do what I need. The implication of the posting
you mention is that in fact no matter what dictionary I pass as the
locale, if something it will sort on the user's default locale. I'll
continue to pass the standard user defaults dictionary none the less so
that my code still works if Apple ever properly implement the feature.
Nicko
> At 5:35 PM +0100 10/6/04, Nicko van Someren wrote:
>> The documentation for NSString's localizedCompare: says "Performs a
>> localized compare between the receiver and string. See Also: -
>> compare:options:range:locale:". Presumably it is simply calling
>> compare:options:range:locale: with some predefined values for
>> options, an empty range and a "local" locale. My question is where
>> does that locale come from? I want to do a localised search with the
>> NSNumericSearch option switched on, so I need to pass in the same
>> locale information.
| Related mails | Author | Date |
|---|---|---|
| Nicko van Someren | Oct 6, 18:35 | |
| Chuck Soper | Oct 6, 20:30 | |
| Nicko van Someren | Oct 6, 20:50 |






Cocoa mail archive

