<pre name="code" class="cpp">// 从路径中获得完整的文件名(带后缀) exestr = [filePath lastPathComponent]; NSLog(@"%@",exestr); // 获得文件名(不带后缀) exestr = [exestr stringByDeletingPathExtension]; NSLog(@"%@",exestr); // 获得文件的扩展类型(不带'.') exestr = [filePath pathExtension]; NSLog(@"%@",exestr);</pre><br> <pre name="code" class="php">NSString *path = @"~/textFile.txt"; NSString *pathExtension = [path pathExtension]; pathExtension这个字符串的值将是“txt”。句点将被去掉了。如果没有句点指明扩展名,将返回一个空串。如果文件不存在,也将返回空串 </pre><br> <br> <pre name="code" class="php">[[imageName componentsSeparatedByString:@"."] objectAtIndex:0] 用.分开, objectAtIndex:0为文件名, objectAtIndex:1为后缀 </pre><br> <pre name="code" class="cpp">iPhone-获取网络数据或者路径的文件名 iPhone中,在网络中的数据流中提取链接中的文件名称时,有很多方法,这里总结一些。 方法一:最直接。 NSString * urlString = @”http://www.baidu.com/img/baidu_logo_fqj_10.gif”; NSString *fileName = [urlString lastPathComponent]; NSLog(@”%@”,fileName); 方法二:根据字符或者时字符串分割。 Object -C NSString *link = @”http://www.baidu.com/img/baidu_logo_fqj_10.gif”; NSString *filename = [[NSString alloc] init]; NSArray *SeparatedArray = [[NSArray alloc]init]; SeparatedArray =[link componentsSeparatedByString:@"/"]; filename = [SeparatedArray lastObject]; NSLog(@”%@”,SeparatedArray); NSLog(@”%@”,filename); [filename release]; 方法三:将链接看成路径。 NSString * urlString = @”http://www.baidu.com/img/baidu_logo_fqj_10.gif”; NSArray *urlCom = [[NSArray alloc]initWithArray:[url pathComponents]]; NSLog(@”%@”,[urlCom lastObject]); [urlCom release]; 方法四:NSRange.它在截取二进制文件的时候十分方便。 NSString * urlString = @”http://www.baidu.com/img/baidu_logo_fqj_10.gif”; NSString * fileName; NSRange range = [urlString rangeOfString:@"/" options:NSBackwardsSearch]; if (range.location != NSNotFound) { fileName = [urlString substringFromIndex:range.location+1]; if([[fileName lowercaseString]hasSuffix:@”.gif”]) { NSLog(@”%@”,fileName); } else { } } else { return; }</pre><br> <br> <pre></pre> <div id="livemargins_control" style="position:absolute; z-index:9999"><img src="" alt="" height="5" width="77" style="position:absolute; left:-77px; top:-5px"></div> <div id="livemargins_control" style="position:absolute; z-index:9999; top:220px; left:5px; width:1px; height:1px"> <img src="" alt="" height="5" width="77" style="position:absolute; left:-77px; top:-5px"></div> <pre></pre> <div id="livemargins_control" style="position:absolute; z-index:9999"><img src="" alt="" height="5" width="77" style="position:absolute; left:-77px; top:-5px"><img src="" alt="" style="position:absolute; left:0; top:-5px"><img id="monitor-play-button" src="" alt="" style="position:absolute; left:1px; top:0"></div> <pre></pre> <div id="livemargins_control" style="position:absolute; z-index:9999"><img src="" alt="" height="5" width="77" style="position:absolute; left:-77px; top:-5px"><img src="" alt="" style="position:absolute; left:0; top:-5px"><img id="monitor-play-button" src="" alt="" style="position:absolute; left:1px; top:0"></div> <pre></pre> <div id="livemargins_control" style="position:absolute; z-index:9999"><img src="" alt="" height="5" width="77" style="position:absolute; left:-77px; top:-5px"><img src="" alt="" style="position:absolute; left:0; top:-5px"><img id="monitor-play-button" src="" alt="" style="position:absolute; left:1px; top:0"></div> <pre></pre> <div id="livemargins_control" style="position:absolute; z-index:9999"><img src="" alt="" height="5" width="77" style="position:absolute; left:-77px; top:-5px"><img src="" alt="" style="position:absolute; left:0; top:-5px"><img id="monitor-play-button" src="" alt="" style="position:absolute; left:1px; top:0"></div> <pre></pre> <div id="livemargins_control" style="position:absolute; z-index:9999"><img src="" alt="" height="5" width="77" style="position:absolute; left:-77px; top:-5px"><img src="" alt="" style="position:absolute; left:0; top:-5px"> <img id="monitor-play-button" src="" alt="" style="position:absolute; left:1px; top:0"></div> <pre></pre> <div id="livemargins_control" style="position:absolute; z-index:9999"><img src="" height="5" width="77" alt="" style="position:absolute; left:-77px; top:-5px"> <img src="" alt="" style="position:absolute; left:0; top:-5px"> <img id="monitor-play-button" src="" alt="" style="position:absolute; left:1px; top:0"></div>
相关推荐
iphone-keyChain保存数据 iphone-keyChain保存数据-官方demo
netdisk_iPhone-2022-07-29-042850.ips
Swift-获取iphone型号
iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow
C#读写iphone中的plist文件的代码,完整的工程文件
西蒙OpenGL ES 教程 IOS开发,ios技术文档,网络收集整理。西蒙iphone-OpenGL ES 教程,共13篇。第8、12章由于有更好的技术,所以被译者跳过
这是做axure的时候可以用的iPhone各种界面。
OpenSSL-for-iPhone-master.zip
iphone-14-pro-max-03405318-info
absinthe-win-2.0.4-iPhone-5.1.1-完美越狱
iphoneos-arm iPhone 必备工具
Apple - iPhone - 机型比较,iphone6 iphone5s and iphone5
cocos2d-iphone-extensions-v0.1.3-Himi-ios-...【Cocos2d游戏开发之十四】音频与音效播放以及利用+Cocos2D-iPhone-Extensions嵌入Cocos2d进行视频播放! http://blog.csdn.net/xiaominghimi/article/details/6870259
iphone-plist-net source and Demo,iphone-plist-net是一个C#读写Plist文件的类库,iphone-plist-net源码及演示程序
iPhone-Explorer-v2-2.dmg,查看ios设备应用程序。
iphone-sdk-2.0-headers 别看的不大 我坚持了一天 1k 1k的下下来的
Documents-iPhone-8.6.1-Support-Log.zip
iPhone-OpenGL-ES-Tutorial-Series-master iphone opengl es 源码
iPhone-5设计图纸
iPhone-5-dimensions