tags:

views:

56

answers:

2

Hi all,

I need a clarification regarding the difference between the NSString and NSMutableString. Can any one expand briefly?

Thank you, Sekhar Bethalam

+2  A: 

An NSString instance cannot be modified once it's initialized - it is "immutable." No NSString methods can modify the string's value.

NSMutableString on the other hand can be modified after it's initialized.

Andy White
A: 

Just to expand on Andy White's answer, there may be performance benefits to using NSString instead of NSMutableString in your code (as always, test using Apple's performance tools to make sure this is truly where your performance bottleneck is). In the situation where you want to change the value of an NSString, one option is to create a entirely new NSString with the altered value in it and then destroy the old NSString.

Gouldsc