[Objective-c 基础

1.NSString基本使用

使用%@占位符输出对象
1     int age = 15;
2     int no = 5;
3     NSString *str2 = [NSString stringWithFormat:@"My age is %d and no is %d", age, no];
4     NSLog(@"%@", str2);
 
2.NSString中的类方法和对象方法
length
1     NSString *name = @"张三李四";
2     NSLog(@"Len = %ld", [name length]);
输出的是字数,而不是像C的字节数
 
 
 
 
 
原文地址:https://www.cnblogs.com/hellovoidworld/p/4119354.html