Aspects


vs


Nsmutablestring

The NSMutableString class declares the programmatic interface to an object that manages a mutable string — that is, a string whose contents can be edited — that conceptually represents an array of Unicode characters.

Nsstring

NSString is the plain-text character-string class in Cocoa and Cocoa Touch

Not for example

Example

"Nsmutablestring nsmutablestring objects provide methods to modify the underlying array of characters they represent while nsstring does not;nsmutablestring exposes methods such as appendstring deletecharactersinrange insertstring replaceoccurenceswithstring etc"

from question  

What is actual difference between NSString and NSMutableString in objective C with the help of example?

"Nsmutablestring nsmutablestring objects provide methods to modify the underlying array of characters they represent while nsstring does not;for example nsmutablestring exposes methods such as appendstring deletecharactersinrange insertstring replaceoccurenceswithstring etc"

from question  

Usage of NSMutableString vs NSString?

Others

Example

Nsstring is more general as it leaves you the oppertunity to create another subclass of it that could add the altering functionality without using the nsmutablestring s implementation why ever you would want that to do

from question  

Why NSMutableString inherits from NSString but not the other way around?

If soapresults is an nsstring either because you declared it so or because you affected an nsstring to it you may instead create a new nsstring by appending string to it then create a mutablecopy from it.;but i don t recommend this as this will generate useless allocations and nsmutablestring is better to avoid this

from question  

NSString may not respond to append string

All-in all the reason is that nsmutablestring is able to do more things than nsstring and can do anything nsstring can hence the direction of inheritance

from question  

Why NSMutableString inherits from NSString but not the other way around?

Note also that using nsmutablestring is more efficient than creating a new nsstring each time a letter is added

from question  

Efficient way to generate a random alphabet string?

Instead you probably should use the nsmutablestring and append the second string to it;you cannot truly append one nsstring to another because the class nsstring is not mutable

from question  

How to append a NSString onto another NSString

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0