Sumanth
Sumanth

Reputation: 4921

how to append String To Mutable string

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...

Upvotes: 5

Views: 9331

Answers (2)

user387184
user387184

Reputation: 11053

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.

Upvotes: 1

0x8badf00d
0x8badf00d

Reputation: 6401

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 ?

Upvotes: 6

Related Questions