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

  • Home
  • SEARCH
  • 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 1014241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:13:27+00:00 2026-05-16T10:13:27+00:00

Hi I have an array of strings separated with a delimeter :. I tried

  • 0

Hi I have an array of strings separated with a delimeter “:”. I tried separating strings using componentsSeparatedByString method and then save the result into an array and later use that array to produce the desired output, but it didn’t worked.

For example

Now my UITableView displays cells as:

Case 1:

How:Many
Too:Many
Apple:Milk
iPhone:Simulator

I want the cells to be displayed on UITableView as:

Case 2:

Many How
Many Too
Milk Apple
Simulator iPhone

This is my cellForRowAtIndexPath method:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
 NSString *entry=[entryKeys objectAtIndex:[indexPath section]];
    NSArray *entrySection=[entries objectForKey:entry];
   cell.textLabel.text=[entrySection objectAtIndex:[indexPath row]]
 }

 return cell;
}

The output of the above method is case 1 but I want the output to be case 2
entryKeys has keys from A-Z and entry section has values sorted and listed for respective keys i.e. entries starting with A grouped under key A so on…

It may sound silly but I am still learning..please help me

  • 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-16T10:13:28+00:00Added an answer on May 16, 2026 at 10:13 am

    There are numerous ways to do this. Here’s one;

    // get your raw text in the form of "AAA:BBB"
    NSString *rawText = [entrySection objectAtIndex:[indexPath row]];
    
    // split the text by the : to get an array containing { "AAA", "BBB" }
    NSArray *splitText = [rawText componentsSeparatedByString:@":"];
    
    // form a new string of the form "BBB AAA" by using the individual entries in the array
    NSString *cellText = [NSString stringWithFormat:@"%@ %@", [splitText objectAtIndex:1], [splitText objectAtIndex:0]];
    

    Hope that helps.

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

Sidebar

Related Questions

I have an array of 1000 strings to load into a combo box. What
Say I have an array of strings in a php array called $foo with
I have a one-dimensional array of strings in JavaScript that I'd like to turn
I have a two-dimensional array (of Strings) which make up my data table (of
I have a simple 2D array of strings and I would like to stuff
Overview: I have an array of 20 byte strings that needs to be stored
What is the PHP preg_replace in C#? I have an array of string that
Lets say I have an array like this: string [] Filelist = ... I
Say I have an array of values: string[] text = new string[] { val1,
I have been working with a string[] array in C# that gets returned from

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.