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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:11:47+00:00 2026-06-18T14:11:47+00:00

This is my code. NSString* seats = @NEWS; NSMutableString *sp = [[NSMutableString alloc] initWithString:@

  • 0

This is my code.

NSString* seats = @"NEWS";
NSMutableString *sp = [[NSMutableString alloc] initWithString:@"             "];
NSArray *dials=@[@[sp, sp, sp, sp], @[sp, sp, sp, sp]];
[dials[0][2] replaceCharactersInRange:NSMakeRange(5, 1) withString:[seats substringWithRange:NSMakeRange(3,1)]];
NSLog(@"dial 0 0 : %@",dials[0][0]);
NSLog(@"dial 0 1 : %@",dials[0][1]);
NSLog(@"dial 0 2 : %@",dials[0][2]);
NSLog(@"dial 0 3 : %@",dials[0][3]);

This is my console readout.

2013-02-08 08:23:26.114 [29075:11303] dial 0 0 :      S       
2013-02-08 08:23:26.115 [29075:11303] dial 0 1 :      S       
2013-02-08 08:23:26.115 [29075:11303] dial 0 2 :      S       
2013-02-08 08:23:26.115 [29075:11303] dial 0 3 :      S       

How can I instead get the following readout, which is what I want?

2013-02-08 08:23:26.114 [29075:11303] dial 0 0 :              
2013-02-08 08:23:26.115 [29075:11303] dial 0 1 :              
2013-02-08 08:23:26.115 [29075:11303] dial 0 2 :      S       
2013-02-08 08:23:26.115 [29075:11303] dial 0 3 :              
  • 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-18T14:11:48+00:00Added an answer on June 18, 2026 at 2:11 pm

    By just doing this:

    NSArray *dials=@[@[sp, sp, [sp mutableCopy], sp], @[sp, sp, sp, sp]];
    

    Got why? If you think well that array just contains duplicate objects. Every pointer is pointing to the same object except dials[0][2], which points to a copied object.

    Putting duplicate objects in the same array is allowed, but it may be conceptually wrong. So also consider copying all the objects.

    Another solution would be to replace your immutable array with mutable strings with a mutable array with immutable strings, and in this case you could also put duplicate objects, and to change an object you should replace it:

    NSString *sp = @"             ";
    NSArray*dials=@[[@[sp, sp, sp, sp]mutableCopy], [@[sp, sp, sp, sp]mutableCopy]];
    NSString* replace= [dials[0][2] stringByReplacingCharactersInRange:NSMakeRange(5, 1) withString:[seats substringWithRange:NSMakeRange(3,1)]];
    [dials[0] replaceObjectAtIndex: 2 withObject: replace];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i found this code -(NSString *) genRandStringLength: (int) len { NSMutableString *randomString = [NSMutableString
Please consider this code: NSString *jsonreturn = [[NSString alloc] initWithContentsOfURL:[ NSURL URLWithString:url ]]; //
This code: NSString *imageString = [info objectForKey:UIImagePickerControllerRefrenceURL]; NSLog(@%@, imageString); Returns this: assets-library://asset/asset.JPG?id=1000000002&ext=JPG Is there
if I run this code: NSString *xml = [[NSString alloc] init]; xml=[NSString stringWithFormat:@<%@>, @msg];
I have this code: NSString *path = [NSString stringWithFormat:@%@/%@, [[NSBundle mainBundle] resourcePath], @change.mp3]; NSURL
i have an error in this code NSString *str = @above string; //load above
I currently have this piece of code: NSString *strURL = [NSString stringWithFormat:@http://www.sample.com /phpFile.php?firstname=%@,txtfirstName.text]; NSString
Im getting data from a server by executing this code: - (void) sendGeneral:(NSString *)
Check this code (My Custom Keyboard): -(IBAction) updateTextBackSpace:(id)sender { if([txtview.text length]>0) { NSString *deletedLastCharString
What is wrong with this code? NSString *strTest = @Sun Apr 12 23:29:24 +0000

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.