NSString is the plain-text character-string class in Cocoa and Cocoa Touch. See also NSMutableString, NSData and NSMutableData (for objects that contain bytes rather than human-language characters), and NSAttributedString and NSMutableAttributedString (for rich-text strings).

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

An NSString is immutable, unless it's an NSMutableString (). NSMutableString is a subclass of NSString.

You will never work with a direct instance of NSString or NSMutableString. Both classes, like most of the other property-list classes, are members of a class cluster.

NSStrings contain human-language characters; you should not attempt to use an NSString to store bytes, including pixel data and XML or HTML markup. (“String” in Cocoa strictly refers to human text; it does not call a byte array a “string” like Python 2 and some other environments do.) To make or receive an object bytes, you should use NSData or NSMutableData (note that, for example, this is what NSXMLParser, WebFrame, and UIWebView take for the XML/HTML source of the document, and what NSURLConnection gives you as you download a resource).

An NSString is always plain text. For rich text, use NSAttributedString or its mutable subclass. Both have always been available on Mac OS X, and have been available on iOS since 3.2.

NSString is toll-free bridged with CFString, which means you can pass an NSString to CF functions expecting a CFString, and receive a CFString and treat it as an NSString. The same goes for the mutable subclass.

Docs: