1、创建常量字符串
NSString *astring = @"my name is haoyanqing!";
2、创建空的字符串,并给其赋值
NSString *astring = [[NSString alloc] init];
astring = @"This is a String!";
[astring release];
NSLog(@"astring:%@",astring);
//
NSString *astring = [[NSString alloc] init];
NSLog(@"0x%.8x", astring);
astring=@"This is a String!";
NSLog(@"0x%.8x", astring);
[astring release];
NSLog(@"astring:%@",astring);
3、initWithString方法
NSString *astring = [[NSString alloc] initWithString:@"This is a String!"];
NSLog(@"astring:%@",astring);
[astring release];