从/Application/Mobile/Lib/123.abc
中获取123.abc
。123.abc的长度不是固定的。
应该怎么做?
NSString *fileName=[str lastPathComponent];
使用NSString
的lastPathComponent
方法
NSString *myString = @"/Application/Mobile/Lib/123.abc";
NSString *lastPath = [myString lastPathComponent];
//lastPath would be equal to 123.abc (or whatever the last path component is.