5

Hi i am new to iphone development,can any one help how to append string to mutable string. im trying to string By appending String Format .application Is crashes...

1
  • Can you add the code that crashes to the question? Commented Sep 4, 2011 at 4:57

2 Answers 2

6

Sample code NSMutableString:

NSMutableString* mutString = [[NSMutableString alloc] init];
    for(int index=0;index<10;index++)
    {
        [mutString appendString:[NSString stringWithFormat:@"%d",index]];
    }
    NSLog(@"Content in MutableString: %@",mutString);

Regarding crash: post your code that crashes. What does it say ?

Sign up to request clarification or add additional context in comments.

1 Comment

appendFormat is also possible
1

There is a crash when you try to append nil to a NSMutableString - check that. Also while it does not crash during append - if your NSMutablestring is not initialized - then nothing works and your app might crash later in the code because there is nothing in your string. Post the crash report, I am sure it will tell you what is going wrong.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.