更新时间:2023-02-23 18:32:20
取自 NSString参考,可以使用:
NSString *theFileName = [[string lastPathComponent] stringByDeletingPathExtension];
lastPathComponent
调用将返回 thefile.ext
, stringByDeletingPathExtension
将从末尾删除扩展名。
The lastPathComponent
call will return thefile.ext
, and the stringByDeletingPathExtension
will remove the extension suffic from the end.