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 8754655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:40:29+00:00 2026-06-13T13:40:29+00:00

i have problem sorting the arrays.i have two problems. 1.Sorting rightArray with the following

  • 0

i have problem sorting the arrays.i have two problems.
1.Sorting rightArray with the following code is not working.
2.i also have a leftArray whose indexes should be changed comparing to the right Array,when right array is sorted.Is it possible?.

NSArray *rightArray = [[NSArray alloc] initWithObjects:[mutArray objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 11)]], nil];
NSArray *sortedArray = [rightArray sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSLog(@"%@",sortedArray);

Output:after i sorted using the above code

2012-10-25 19:11:44.571 Converter[3511:207] (
    (
    USD,
    EUR,
    GBP,
    JPY,
    CAD,
    AUD,
    INR,
    CHF,
    CNY,
    KWD,
    SGD
)
)
  • 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-06-13T13:40:31+00:00Added an answer on June 13, 2026 at 1:40 pm
    NSArray *rightArray = [[NSArray alloc] initWithObjects:[mutArray objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 11)]], nil];
    NSArray *sortedArray = [[rightArray lastObject] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
    NSLog(@"%@",sortedArray);
    

    Your strings are in an array in your array. Get the only object in rightArray and sort it.

    edit

    For the second question you can use an intermediate data structure

    NSMutableDictionary *temp = [[NSMutableDictionary alloc] init];
    NSArray *keys = [rightArray lastObject]; 
    NSArray *objs = [leftArray lastObject]; // presuming they're also an array in an array
    
    for (int i = 0; i < [keys count]; i++) {
        // we'll use the dictionary to set an one-to-one relationship
        [temp setObject:[objs objectAtIndex:i] forKey:[keys objectAtIndex:i]];
    }
    
    NSArray *sortedKeys = [keys sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
    NSArray *sortedObjs = [temp objectsForKeys:sortedKeys notFoundMarker:[NSNull null]];
    [temp release]; // if not using ARC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code which is sorting a list of javascript objects in
I have a problem with sorting... I need to sort NSArray containing NSDictionaries .
I have a problem with sorting NSTableColumn contents. In my NSTableView there are three
I have a problem with sorting items in table in PHP. Here is what
I have a complex sorting problem with my SQL statement. I have a table
I have a problem on using LinqToSQL with paging + dynamic sorting. These are
I have a set of problems with sunspot and enconding issues when sorting. The
I have two arrays values and keys both of the same length. I want
I'm building a node.js application with Mongoose and have a problem related to sorting
I got problem for sorting array of nsdate. so i have array of date

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.