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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:03:24+00:00 2026-05-24T06:03:24+00:00

I’m extracting some string data from a plist: <dict> <key>Feb 7, 2000</key> <array> <string>7</string>

  • 0

I’m extracting some string data from a plist:

<dict>
<key>Feb 7, 2000</key>
<array>
    <string>7</string>
    <string>8</string>
</array>
<key>Jan 27, 2001</key>
<array>
    <string>8</string>
    <string>7</string>
</array>

and using the following code to output the data in a UILabel:

  NSString * myString = [NSString stringWithFormat:@"%@",self.data];

    myLabel.text = myString;

the output is being displayed as ( 7, 8)

does anyone know how i might go about removing the parenthesis and comma. and also separating the values so I could display something like first: 7 second: 8

  • 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-24T06:03:26+00:00Added an answer on May 24, 2026 at 6:03 am

    Example:

    <dict>
    <key>Feb 7, 2000</key>
    <array>
        <string>7</string>
        <string>8</string>
    </array>
    <key>Jan 27, 2001</key>
    <array>
        <string>8</string>
        <string>7</string>
    </array>
    </dict>
    

    Code:

    NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:path]; 
    
    for(id key in dict) {
        NSLog(@"First:%@ Second:%@", [[dict objectForKey:key] objectAtIndex:0],  [[dict objectForKey:key] objectAtIndex:1]);
    }
    

    Output:

    First:7 Second:8
    First:8 Second:7
    

    EDIT (response to comment)

    First you need to determine the keys within the NSMutableDictionary.
    Load the .plist file, loop through and add the keys to an NSMutableArray.

    NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:path]; 
    NSMutableArray *keys = [[NSMutableArray alloc] init];
    for(id key in dict) [keys addObject:[NSString stringWithFormat:@"%@",key]];
    

    Make sure the array can be accessed by the UIPickerView.
    The UIPickerView should be able to retrieve the keys like this:

    - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
    {
        return [keys objectAtIndex:row];
    }
    
    - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
    {
        return [keys count];
    }
    
    - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;
    {
        return 1;
    }
    

    Finally, update the UILabel like this:

    - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
    {
        theLabel.text = [NSString stringWithFormat:@"First:%@ Second:%@", 
                          [[dict objectForKey:[keys objectAtIndex:row]] objectAtIndex:0],  
                          [[dict objectForKey:[keys objectAtIndex:row]] objectAtIndex:1]];
    }
    

    The UIPickerView now contains the following rows:

    Feb 7, 2000
    Jan 27, 2001
    

    When for example “Jan 27, 2001” is selected, the UILabel shows:

    First:8 Second:7
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have some data like this: 1 2 3 4 5 9 2 6
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And

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.