function to get the file name of an URL

前端 未结 6 1914
时光说笑
时光说笑 2021-01-30 05:23

I have some source code to get the file name of an url

for example:

http://www.google.com/a.pdf

I hope to get a.pdf

because the way to join 2 NSS

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 05:36

    Swift 3

    Let's say that your url is http://www.google.com/a.pdf

        let filename = url.lastPathComponent
    
        \\filename = "a.pdf"
    

提交回复
热议问题