NSString
*str1 = @"a string";
NSString *str2
= [[NSString alloc] init];
str2 = @"a
string";
[str2 release];
NSString *str3
= [[NSString alloc] initWithString:@"a string"];
[str3 release];
NSString *str4
= [NSString stringWithString:@"a string"];
[str4 release];
NSString *str5
= [[NSString alloc] initWithUTF8String:"a string"];
[str5 release];
NSString *str6
= [NSString stringWithUTF8String:"a string"];
NSString *str7
= [NSString stringWithFormat:@"a string %d", 5];
NSLog(@"%@",str7);
Object C (2) --- NSString的创建,布布扣,bubuko.com
时间: 2024-11-06 03:32:09