#import<Foundation/Foundation.h>spa
@interfacePerson : NSObject.net
{orm
//char *_name;字符串
NSString *_name;get
}string
@end it
intmain()io
{ast
/*class
// 最簡單的建立字符串的方式
NSString*str = @"itcast";
char *name = "itcast";
NSLog(@"我在%@上課",str);
//NSLog(@"%s", name);
*/
int age = 15;
int no = 5;
NSString *name = @"哈哈jack";
// length方法算的是字數
int size = [name length];
NSLog(@"%d", size);
// 建立OC字符串的另外一種方式
NSString *newStr = [NSString stringWithFormat:@"My age is %d and no is %d and nameis %@", age, no, name];
NSLog(@"---- %ld", [newStrlength]);
return 0;
}