
Last chance! 50% off unlimited learning
Sale ends in
Get the base names of URLs via basename()
, and remove the
possible query parameters or hash from the names.
url_filename(x, default = "index.html")
A character vector of filenames at the end of URLs.
A character vector of URLs.
The default filename when it cannot be determined from the URL, e.g., when the URL ends with a slash.
xfun::url_filename("https://yihui.org/images/logo.png")
xfun::url_filename("https://yihui.org/index.html")
xfun::url_filename("https://yihui.org/index.html?foo=bar")
xfun::url_filename("https://yihui.org/index.html#about")
xfun::url_filename("https://yihui.org")
xfun::url_filename("https://yihui.org/")
Run the code above in your browser using DataLab