如何从给定的文件路径字符串获取文件名?
例如,如果我有一个文件路径字符串为
file:///Users/DeveloperTeam/Library/Developer/CoreSimulator/Devices/F33222DF-D8F0-448B-A127-C5B03C64D0DC/data/Containers/Data/Application/5D0A6264-6007-4E69-A63B-D77868EA1807/tmp/trim.D152E6EA-D19D-4E3F-8110-6EACB2833CE3.MOV
我想得到返回结果
trim.D152E6EA-D19D-4E3F-8110-6EACB2833CE3.MOV
谢谢您的帮助。
目标C
NSString* theFileName = [string lastPathComponent]
迅速
let theFileName = (string as NSString).lastPathComponent