ios - How to get the filename from the filepath in swift -


how filename given file path string?

for example if have filepath string

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 

and return result

trim.d152e6ea-d19d-4e3f-8110-6eacb2833ce3.mov  

thank help.

objective c

nsstring* thefilename = [string lastpathcomponent] 

swift

let thefilename = (string nsstring).lastpathcomponent 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -