String class: NSString The length of the object created and cannot be changed
Create string (first) (most commonly used)
NSString *string1 = @ "iphone";
Create a string (the second type)
NSString *string2 = [[NSString alloc]initwithstring: string1];
NSLog (@ "%@", string2);
NSString.h how to appear always press cmd and click on it.
The third kind is not used
NSString *string3 = [NSString string]; Create an empty string with the convenience constructor method
NSLog (@ "%@", string3);
The fourth kind is not used
NSString *string4 = [NSString stringwithstring: string1];
NSLog (@ "%@", String4);
Fifth type
[[NSString alloc]initwithstring:<# (NSString *) #>]
NSString *string5 = [[NSString alloc]initwithformat: @ "%@%@", string1,
STRING2]; Can pass multiple parameters, this must be remembered.
NSLog (@ "%@", string5);
The sixth type (most commonly used
NSString *string6 = [NSString stringwithformat:@ "%@%@", string1,string2];
NSLog (@ "%@", String6);
How to create a string (OC)