1. OC There are several ways to create a string object? For example: How to create a String object: @ "Baby".
There are 3 ways to create a string object in OC:
Example: In the main.m file:
Console output:
2. How do I get the length of a string in OC?
The length of the string to be obtained in OC is "Length";
Example: In the mian.m file:
Console output:
3. Judge whether the string starts or ends with the specified string;
Example: In the main.m file:
Console output:
4. Find the range of a string within another string. As found in the string @ "Love You" at @ "I love you" in the range.
Example: In the main.m file:
Console output:
5. What is the method for splicing of immutable strings? Which method is used for variable string concatenation?
Example: In the main.m file:
Console output:
6, such as: nsmutablestring * str1 = @ "Deskmate";
nsmutablestring * str2 = @ "I love You";
Speaking of the following 2 cases of execution, the output str1 the result is God horse? Why is this result?
(1). [Str1 STRINGBYAPPENDINGSTRING:STR2]; (2). [Str1 APPENDINGSTRING:STR2];
(1) The result is: I love you at the same table. Reason: concatenation of strings; (2) Error reason: No visible @interface "nsmutablestring" declares the "appendingstring".
7. How many ways to create an array? Try to create an array in these ways.
Example: In the main.m file:
Console output:
8, the array can only store data?
Only OC objects can be managed in an array, and the objects it manages may be of different types.
9, how to get an array of the number of elements?
Example: In the main.m file:
Console output:
10, such as an array of existing arrays of objects, such as to set the label 3, how I access the array of corresponding subscript element (object) according to the subscript.
Example: In the main.m file:
Console output:
11. How do I create a mutable array? How do I add an array element (object) to the array? How do I iterate over this array? Use code to illustrate.
Example: In the main.m file:
Console output:
12, how to create an empty array?
Example: In the main.m file:
Console output:
Email:[email protected]
Objective-c Quick Start-Basics (iii)