A dynamic plain-text Unicode string object, for use instead of a
String variable in cases that require reference semantics.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
NSMutable 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. To construct and manage an immutable string—or a string that cannot be changed after it has been created—use an object of the
NSMutable class adds one primitive method—
replace—to the basic string-handling behavior inherited from
NSString. All other methods that modify a string work through this method. For example,
insert(_: simply replaces the characters in a range of
0 length, while
delete replaces the characters in a given range with no characters.