Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6708197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:43:48+00:00 2026-05-26T07:43:48+00:00

I have read http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Collections/Articles/Arrays.html%23//apple_ref/doc/uid/20000132-SW5 But I did not find a solution to my problem.

  • 0

I have read
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Collections/Articles/Arrays.html%23//apple_ref/doc/uid/20000132-SW5

But I did not find a solution to my problem.

I wrote:

NSArray *sorted = [unsorted sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];

shows the sorted order A-Z with Æ and Å among A, Ø among O.
It is supposed to be A-Z-Æ-Ø-Å, since I used localized.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:43:49+00:00Added an answer on May 26, 2026 at 7:43 am

    Overriding the user’s language for the entire application is generally not considered to be a good way to force the locale for a particular operation, as the user’s preferences should determine how data is sorted. If, for example, you have a language class or an otherwise intentionally-dual-language program), you might find it useful to the user to override the sorting order just for certain elements of the program. Although it’s a bit more work, if you need to make sure that the particular strings are always sorted in order for a particular locale, you should use the long form of the compare:

    - (NSComparisonResult)compare:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)range locale:(id)locale
    

    You can get the locale for Norwegian by using the call:

    NSLocale *noLocale = [[[NSLocale alloc] initWithLocaleIdentifier:@"no_NO"] autorelease];
    

    So, you’d end up calling:

    NSArray *sorted = [unsorted sortedArrayUsingComparator :^(id obj1, id obj2) {
        NSRange theRange = NSMakeRange( 0, [obj1 length]);
        return [obj1 compare: obj2 options: NSCaseInsensitiveSearch range: theRange locale: noLocale];
    }];
    

    This will not set the default language for the rest of the program, but it will explicitly use the specified locale in that particular comparison.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was reading this paper from Apple: http://developer.apple.com/library/mac/documentation/cocoa/conceptual/OOP_ObjC/OOP_ObjC.pdf where it talks about OOP which
I have read the Apple docs - http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/TabBarControllers/TabBarControllers.html#//apple_ref/doc/uid/TP40007457-CH102-SW1 about creating TabBar programmatically. I want
I have read the documentation ( http://dev.mysql.com/doc/refman/5.1/en/partitioning.html ), but I would like, in your
I have read http://developer.android.com/guide/practices/screens_support.html and http://developer.android.com/reference/android/util/DisplayMetrics.html and I somehow left with a gap here.
From this page (http://developer.apple.com/programs/ios/distribute.html) I've read this Custom B2B Apps You can also offer
I read http://developer.android.com/reference/android/app/Activity.html but I have a question about PreferenceActivity lifecycle: Does a PreferenceActivity
I have read the screen support API guide (http://developer.android.com/guide/practices/screens_support.html) and much more resources, but
Hy! I read this http://developer.android.com/guide/developing/projects/projects-eclipse.html but when i press add library the downloaded libary
i've just downloaded the Yahoo BOSS Mashup framework from http://developer.yahoo.com/search/boss/mashup.html , and I have
I have read through the Web Services site at http://developer.rallydev.com/help/ The basic issue I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.