几种字符串拼接方式
来源:互联网 发布:php权限管理系统 编辑:程序博客网 时间:2024/05/21 17:11
// 1.拼接字符串 NSString* homePath = NSHomeDirectory(); // 简单拼接字符串 NSString* docPath1 = [homePath stringByAppendingString:@"/Documents"]; // 拼接路径,自动中间加"/" NSString *docPath2 = [homePath stringByAppendingPathComponent:@"Documents"]; // 拼接扩展名,文件后缀,自动中间加"." NSString *docPath3 = [homePath stringByAppendingPathExtension:@"Documents"]; // 格式化拼接字符串 NSString *str = @"Documents"; NSString *docPath4 = [homePath stringByAppendingFormat:@"/%@", str]; NSLog(@"---%@", docPath1); NSLog(@"---%@", docPath2); NSLog(@"---%@", docPath3); NSLog(@"---%@", docPath4);
输出结果:
2015-11-26 20:19:22.608 01-plist存储[3822:360712] ---/Users/zh/Library/Developer/CoreSimulator/Devices/8EE05444-0DC3-49F7-A827-DCE72186F069/data/Containers/Data/Application/42691849-97D7-49C7-89AB-C0713B655D08/Documents2015-11-26 20:19:22.608 01-plist存储[3822:360712] ---/Users/zh/Library/Developer/CoreSimulator/Devices/8EE05444-0DC3-49F7-A827-DCE72186F069/data/Containers/Data/Application/42691849-97D7-49C7-89AB-C0713B655D08/Documents2015-11-26 20:19:22.609 01-plist存储[3822:360712] ---/Users/zh/Library/Developer/CoreSimulator/Devices/8EE05444-0DC3-49F7-A827-DCE72186F069/data/Containers/Data/Application/42691849-97D7-49C7-89AB-C0713B655D08.Documents2015-11-26 20:19:22.609 01-plist存储[3822:360712] ---/Users/zh/Library/Developer/CoreSimulator/Devices/8EE05444-0DC3-49F7-A827-DCE72186F069/data/Containers/Data/Application/42691849-97D7-49C7-89AB-C0713B655D08/Documents
0 0
- 几种字符串拼接方式
- 字符串拼接的几种方式
- C# 拼接字符串的几种方式和性能
- JSON的几种拼接方式
- 几种拼接字符串的效率问题
- 几种拼接字符串的效率问题
- 几种拼接字符串的效率问题 .
- 几种拼接字符串的效率问题 .
- appendChild、拼接string、join三种方式比较字符串拼接
- 三种字符串拼接方式比较
- Python字符串拼接的五种方式
- Java字符串拼接三种方式比较
- 字符串拼接方式
- python字符串与非字符串拼接三种方式
- Android几种字符串拼接的速度比较
- 字符串拼接方式(待商榷)
- iOS拼接字符串的方式
- 拼接字符串的三个方式
- 第七章 控件学习总结
- g++的编译及调试
- Win10 10586 更新
- iOS开发之控制器的创建
- Python计算机视觉编程练习10:csv 模块学习
- 几种字符串拼接方式
- 在Eclipse或者ADT中使用ButterKnifeZelezny,Android组件初始化从此变得简单易懂!!!!,androideclipseadt
- 计算机组成的五大部分
- 正则表达式的威力3_获取 find()和group()
- Segmentation Reading List
- 面试(二)
- 使用git操作github配置
- [Javascript Function] Arguments, call(), apply(), caller(), callee()
- 线程之间的同步和通信,synchronized,wait(),notify(),notifyAll()