API NSString 中比较有趣的函数
2015-12-19 21:25
239 查看
<span style="font-size:18px;">+ (instancetype)stringWithFormat:(NSString *)format,</span>
<span style="font-size:18px;">类方法 以 NSString 引用</span>
<span style="font-size:18px;"> </span>
<span style="font-size:18px;"> </span>
<span style="font-size:18px;"> </span>
<span style="font-size:18px;"> // 最常用的 NSString API // + [(insrancetype)stringWithFormat:(NSString *)format]; //赋值 方法 + 复制 方法 + 将 整数类型 转换成 字符串类型 + 拼接 // 类方法 用类名 调用</span>
<span style="font-size:18px;"> // 赋值 NSString * stra = [NSString stringWithFormat:@"陈子键"]; NSLog(@"stra: %@",stra);</span>
<span style="font-size:18px;"> // 复制 (覆盖) NSString * strb = @"chenpei"; NSString * strc = [NSString stringWithFormat:@"%@",strb]; NSLog(@"strc: %@",strc);</span>
<span style="font-size:18px;"> // 将 整型 装换成 字符串类型 NSInteger numbera = 456123; NSString * strd = [NSString stringWithFormat:@"%ld",numbera ]; NSLog(@"strd: %@",strd);</span>
<span style="font-size:18px;"> // 拼接 NSString * stre = @"陈策"; NSString * strf = @"黄深"; strf = [NSString stringWithFormat:@"%@%@",stre,strf]; NSLog(@"%@",strf); </span>几乎是万能的NSString 函数
相关文章推荐
- form表单提交无页面刷新(非js)
- Linux 使用 NTP 时钟同步
- Android中图表AChartEngine学习使用与例子
- self和super之间的区别
- Mysql忘记密码
- 第十六周--学期总结
- 图的应用——珍珠
- (解题报告)HDU2024---C语言合法标识符
- 搜索与机器学习的两篇相关文章
- Spark SQL and DataFrames Version 1.6
- 高仿google now效果的呼吸按钮简单实现
- leetcode (1) Two Sum js代码实现
- 最简单的奇数阶幻方(魔方)算法详解
- mysql打开速度很慢
- UDP通信
- JDBC为什么使用反射加载驱动
- duilib相关信息和网址
- 福建第四届省赛
- 拯救oibh总部
- psql-10权限和事务