Note that there are some explanatory texts on larger screens.

plurals
  1. POSorting arraylist in correct order in Objective C
    primarykey
    data
    text
    <p>I have a list of array keys that i am getting from a dictionary by using below code :</p> <pre><code> NSArray*keys=[dictionary allKeys]; </code></pre> <p>Value of keys are coming like this :</p> <pre><code>Fact tags - 1 , Fact tags - 14 , Brochure , Balloon , Fact tags - 10 , Fact tags - 2 , Fact tags - 12 , Fact tags - 3 , Booklet , Fact tags - 15 , Fact tags - 5 , Fact tags - 13 , Fact tags - 4 , Fact tags - 11 , Fact tags - 6 , Fact tags - 9 , Fact tags - 8 , Fact tags - 7 , </code></pre> <p>So, for array list sorting. i am using below code:</p> <pre><code>keys = [keys sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]; </code></pre> <p>Now, my keys output is :</p> <pre><code>Balloon , Booklet , Brochure , Fact tags - 1 , Fact tags - 10 , Fact tags - 11 , Fact tags - 12 , Fact tags - 13 , Fact tags - 14 , Fact tags - 15 , Fact tags - 2 , Fact tags - 3 , Fact tags - 4 , Fact tags - 5 , Fact tags - 6 , Fact tags - 7 , Fact tags - 8 , Fact tags - 9 , </code></pre> <p>Here it is sorting an array alphabetically, But i want my array list output like below list:</p> <pre><code>Balloon , Booklet , Brochure , Fact tags - 1 , Fact tags - 2 , Fact tags - 3 , Fact tags - 4 , Fact tags - 5 , Fact tags - 6 , Fact tags - 7 , Fact tags - 8 , Fact tags - 9 , Fact tags - 10 , Fact tags - 11 , Fact tags - 12 , Fact tags - 13 , Fact tags - 14 , Fact tags - 15 , </code></pre> <p>Can you please tell me that what changes i need to do in my code for such type of sorting ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload