oc-2-string

Source: Internet
Author: User

Course Highlights:

    • Differences between C-language strings and OC language strings
    • The difference between a class method and an object method
    • Understand the differences between nsstring (mutable strings) and nsmutablestring (immutable strings)
    • NSString (Immutable string)
    • nsmutablestring (variable string)
    • Discrimination between NSString and nsmutablestring use

Differences between C-language strings and OC language strings

  // in the C-language phase we define a string variable in the following format:  
char// char is the data type of the character, CString is the variable name, * is a pointer, where he plays the role is, represents CString is a string variable // the format of defining a string variable in the OC phase is the same /// However at this point NSString is no longer called a data type in OC, but is called a class, Ocstring is no longer called a variable name but is called an object. * This is still a pointer, which represents the declared object is the NSString type.

PS: In C we say that the string is actually an array, and the array contains each character in the string. In OC, each string object is indeed a string.

String

#pragma mark----------Understand the difference between nsstring (immutable strings) and nsmutablestring (mutable strings)-----------

#pragma mark------------------nsstring (immutable string)----------------

#pragma mark to create a string constant

#pragma mark to create a formatted string heap area

#pragma the mark string comparison

#pragma the conversion of the Mark string

Interception and splicing of #pragma mark string

#pragma mark---------nsmutablestring (variable string)------

PS: All of the previous operations on NSString (immutable strings) We are all processing the entire string, unable to make a single string to be added to the operation of the check. Now let's use nsmutablestring (variable string) for additional

#pragma Mark added

#pragma mark Delete

#pragma mark changed

#pragma mark.

oc-2-string

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.