Learn R Programming

xfun (version 0.33)

url_filename: Extract filenames from a URLs

Description

Get the base names of URLs via basename(), and remove the possible query parameters or hash from the names.

Usage

url_filename(x)

Value

A character vector of filenames at the end of URLs.

Arguments

x

A character vector of URLs.

Examples

Run this code
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")

Run the code above in your browser using DataLab