How to sort array?

Discussion in 'iOS Programming' started by mikezang, Nov 22, 2010.

  1. mikezang macrumors 6502a

    mikezang

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    I have a array with string with letters , I hope they can sorted as below, what can I do? I read NSArray about sort methods, but I am not sure how to do in detail, can you help me?

    A < ā < á < ǎ < à < B... < D < E < ē < é < ě < è < F .. < I < ī < í < ǐ < ì < J .. < N < O < ō < ó < ǒ < ò < P ... < T < U < ū < ú < ǔ < ù < ǖ < ǘ < ǚ < ǜ < V ... < Z
     
  2. ianray macrumors 6502

    Joined:
    Jun 22, 2010
    Location:
    @
    #2
    Obviously the above is just an example, but the Finnish alphabet is ordered as follows: a,b,c,..,x,y,z,å,ä,ö.

    Apple's developer documentation is pretty good, see: Searching, Comparing, and Sorting Strings
     
  3. mikezang thread starter macrumors 6502a

    mikezang

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #3
    Thanks for your link, I had read it, but it seems like very complex, I hope if I can find a simple and direct code...
    Anyway, I will try to find it by myself and wait for a expert give me suggestion.
     
  4. VanMac macrumors 6502a

    VanMac

    Joined:
    May 26, 2005
    Location:
    Rampaging Tokyo
    #4
    An Objective-C tutorial would probably be in order.
    Code:
    NSArray *sortedArray =
        [myArray sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
    
     

Share This Page