The OBJECTIVE-C programming is mainly used in two framework foundation and Applicationkit. The foundation framework mainly defines some basic classes. All classes in the foundation framework inherit from the NSObject object.
The number types mentioned in the foundation framework can be encapsulated into an object by the NS number type and then manipulated by the corresponding object.
1. Introduction to Digital objects
2. Creation and initialization of numeric objects
2.1 Initialized with the Numberwith base data type (the base data type is capitalized in the first letter).
Format: Digital object =[nsnumber creation and initialization method * * *];
2.2 initialized with the Initwith base data type.
Format: Numeric object name ==[[nsnumberalloc] Initialization method initialization value];
3. Value of a numeric object
Format: [Object name base data type value];
The string type mentioned in the 4.Foundation framework can be encapsulated into an object by an NS string type, and then manipulated on the object. Strings can be divided into modifiable (nsstring) and non-modifiable (nsmutablestring);
4.1. Non-modifiable strings in OC
Format: NSString * Identifier [email protected] "string to be assigned";
String Common functions:
Stringwithstring create another string with one string
Format: stringwithstring: (nsstring*) string
stringWithFormat Direct assignment of a string
Format: stringwithformat:nsstring
Stringbyappendingstring adds a string to the back of a string
Format: stringbyappendingstring:nsstring
Isequaltostring Comparison of two strings
Format: isequaltostring:nsstring
Hasprefix:nsstring is used to judge a string prefix (such as a domain name, website).
Hassuffix:nsstring is used to determine string suffixes (such as finding files in MP3, video, and so on).
The return value type of the above two functions is type bool, and the returned result is yes or no;
Uppercasestring Convert lowercase letters to uppercase
Format: String variable 2=[string variable name 1 uppercasestring];
LowerCaseString converts uppercase letters in a string to lowercase letters
Format: String variable name 2=[string variable name 1lowercaseString].
Substringtoindex A string that is used to intercept n characters
Format: String variable 2=[string variable 1 substringtoindex:n];
4.2NSString strings cannot be modified. Use nsmutablestring if you need to insert, delete, or otherwise manipulate a string object. It can be said that Nsmutablestring is a subclass of NSString, so Nsmutablestring inherits all the class methods and object methods of NSString.
Numerical object of basic object of foundation frame in OC