locale sensitive string comparison on Tiger
locale sensitive string comparison on Tiger
- Subject: locale sensitive string comparison on Tiger
- From: Martin Wierschin <email@hidden>
- Date: Thu, 14 May 2009 00:51:23 -0700
Hi everyone,
I'm attempting to compare some strings using arbitrary locales. On
Leopard this works fine, the NSString method
"compare:options:range:locale:" accepts an actual NSLocale instance.
However, on Tiger the parameter is typed as NSDictionary. Searching
the archives turns up that the dictionary should be generated like so:
NSDictionary* localeDict = [[NSUserDefaults standardUserDefaults]
dictionaryRepresentation];
Ignoring the weirdness of that, I'm sure it works great for the
current locale, but I need a dictionary for an arbitrary locale, eg:
NSLocale* locale = [[NSLocale alloc]
initWithLocaleIdentifier:@"is"]; // Iceland
How do I go about generating one? I tried using:
NSDictionary* localeDict = [NSLocale
componentsFromLocaleIdentifier:@"is"];
But it doesn't seem to affect the comparison results. Am I just out
of luck on Tiger?
TIA,
~Martin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden