1

如果我有一个作为 NSString 的 Url,例如: http ://www.abarid.com/Mobile_apps/products_thumb/Untitled2.png

我只想将 (Untitled2) 作为另一个 NSString,如何在 iPhone 代码中做到这一点?

提前致谢。

4

2 回答 2

4
NSString* theExtractedName = [[yoururl lastPathComponent] stringByDeletingPathExtension]

lastPathComponent调用将返回“Untitled2.png”,stringByDeletingPathExtension并将删除“.png”

于 2013-11-08T21:44:12.340 回答
0

使用实例方法lastPathComponent

于 2013-11-08T21:36:31.033 回答