lundi 25 septembre 2017

swift3 - replace url

I should replace download URL like "../~~~~.pdf.2.3"(.zip, .xls etc...) to "../~~~.pdf"

If I use url.lastPathComponent, returning nil.

So I did like this code.

let fileLastPathComponents = remoteFileUrl.absoluteString.components(separatedBy: "/")
    let lastPathComponent = fileLastPathComponents[fileLastPathComponents.count - 1]
    let fileName = lastPathComponent.components(separatedBy: ".")
    let fileNameStr = "\(fileName[0]).\(fileName[1])"

It was worked but removingPercentEncoding not worked (return nil)

How can I bring encoded file name?

I cannot change this Server

Thank you




Aucun commentaire:

Enregistrer un commentaire