0
我应该将“../~~~~.pdf.2.3"(.zip,.xls etc ...”等下载网址替换为“../~~~.pdf”swift3 - 替换url
如果我使用url.lastPathComponent,返回nil。
所以我喜欢这段代码。
let fileLastPathComponents = remoteFileUrl.absoluteString.components(separatedBy: "/")
let lastPathComponent = fileLastPathComponents[fileLastPathComponents.count - 1]
let fileName = lastPathComponent.components(separatedBy: ".")
let fileNameStr = "\(fileName[0]).\(fileName[1])"
它的工作,但removingPercentEncoding没有奏效(返程无)
我如何帮助编码后的文件名?
我不能改变这个服务器
谢谢
什么结果你在这里'lastPathComponent' –
lastPathComponent返回nil太 –
你这里得到的结果'remoteFileUrl.absoluteString' –