-1
Given a printable ASCII string representing a path to a file on a POSIX-compliant system, return just the filename, i.e. remove everything until and including the last slash (/
):
/full/path/file.name.ext
→ file.name.ext
nopath.here
→ nopath.here
dir/.hidden
→ .hidden
/dirs.can/have.exts/file
→ file
./here
→ here
don't\do this
→ don't\do this
I‘m just curious to see how this is done in a variety of languages...ie whether there‘s any jumping through hoops or if is built-in. Can you suggest a better way to find that out? – MBaas – 2018-03-09T08:56:34.037
There is this challenge, although not exactly a dupe.
– user202729 – 2018-03-09T09:05:02.300Now, I doubt that there is any difference between this and the "what's the file extension" challenge, as they're just "shortest substring after a
<'.' or '/', depends on the challenge
". – user202729 – 2018-03-09T11:11:58.7872@user202729 Right, I'm kind of awaiting it to be re-opened so I can dupe-hammer it. – Adám – 2018-03-09T11:20:53.823