NSString, NSMutableString, nsstring

Source: Internet
Author: User

NSString, NSMutableString, nsstring
NSString

NOTE

An immutable string is a text string that is defined when it is created and subsequently cannot be changed. an immutable string is implemented as an array of Unicode characters (in other words, a text string ). to create and manage an immutable string, use the NSString class. to construct and manage a string that can be changed after it has been created, use NSMutableString.

NSString manages the object of the Self-string
Content: Read-only, unchangeable

Note: To Inherit NSString, you must overload the characterAtIndex: and length methods.
Encoding method: unicode. This method availableStringEncodings allows you to view the provided encoding. You can specify the encoding when converting strings of other types.

NString self-character string constants are the same as those in C language. They will be in a constant area during compilation and will not be released until the program is completed.

NSMutableString

It is a subclass of NSString and only one variable region.

Vulnerabilities in programming
When the return type of the function is NSString, the function returns NSMutableString, which is correct, but the variable that accepts the returned value points to NSMutableString. When it is accidentally changed, the variable will also change, copy the file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.