iOS 从url中获取文件名以及后缀
2014-01-02 11:39
861 查看
//这里有一个模拟器沙盒路径(完整路径)
NSString* index=@"/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books/2013_50.zip";
对路径截取的9种操作
NSLog(@"1=%@",[index lastPathComponent]);
NSLog(@"2=%@",[index stringByDeletingLastPathComponent]);
NSLog(@"3=%@",[index pathExtension]);
NSLog(@"4=%@",[index stringByDeletingPathExtension]);
NSLog(@"5=%@",[index stringByAbbreviatingWithTildeInPath]);
NSLog(@"6=%@",[index stringByExpandingTildeInPath]);
NSLog(@"7=%@",[index stringByStandardizingPath]);
NSLog(@"8=%@",[index stringByResolvingSymlinksInPath]);
NSLog(@"9=%@",[[index lastPathComponent] stringByDeletingPathExtension]);
对应结果
1=2013_50.zip
2=/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books
3=zip
4=/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books/2013_50
5=~/Documents/DownLoad/books/2013_50.zip
6=/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books/2013_50.zip
7=/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books/2013_50.zip
8=/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books/2013_50.zip
9=2013_50
NSString* index=@"/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books/2013_50.zip";
对路径截取的9种操作
NSLog(@"1=%@",[index lastPathComponent]);
NSLog(@"2=%@",[index stringByDeletingLastPathComponent]);
NSLog(@"3=%@",[index pathExtension]);
NSLog(@"4=%@",[index stringByDeletingPathExtension]);
NSLog(@"5=%@",[index stringByAbbreviatingWithTildeInPath]);
NSLog(@"6=%@",[index stringByExpandingTildeInPath]);
NSLog(@"7=%@",[index stringByStandardizingPath]);
NSLog(@"8=%@",[index stringByResolvingSymlinksInPath]);
NSLog(@"9=%@",[[index lastPathComponent] stringByDeletingPathExtension]);
对应结果
1=2013_50.zip
2=/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books
3=zip
4=/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books/2013_50
5=~/Documents/DownLoad/books/2013_50.zip
6=/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books/2013_50.zip
7=/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books/2013_50.zip
8=/Users/junzoo/Library/Application Support/iPhone Simulator/7.0.3/Applications/63925F20-AF97-4610-AF1C-B6B4157D1D92/Documents/DownLoad/books/2013_50.zip
9=2013_50
相关文章推荐
- iOS 从url中获取文件名以及后缀
- [iOS] 从url中获取文件名以及后缀
- IOS 获取网络数据或者路径的文件名以及后缀
- IOS 获取网络数据或者路径的文件名以及后缀
- iPhone-获取网络数据或者路径的文件名以及后缀
- iPhone-获取网络数据或者路径的文件名以及后缀
- 快速获取url文件名和后缀名
- iOS 从url中获取文件名
- iOS 从一个完整路径中获取不带后缀的文件名
- iPhone-获取网络数据或者路径的文件名以及后缀
- 获取URL文件名后缀
- iPhone-获取网络数据或者路径的文件名以及后缀
- iPhone-获取网络数据或者路径的文件名以及后缀
- iPhone-获取网络数据或者路径的文件名以及后缀
- 获取URL文件名后缀
- 获取URL字符串的文件名后缀
- iOS获取文件的文件名和后缀
- 获取百度搜索结果的真实url以及摘要和时间
- IOS 8 模拟器中工程的 .app路径和 沙盒路径的获取方式以及路径对比
- [iOS 开发] 如何获取设备唯一标识?以及多个App间如何共享同一个设备唯一标识?