fileExt: Extract File Extension From File Path or URL

View source: R/utilsFiles.R

fileExtR Documentation

Extract File Extension From File Path or URL

Description

This function takes a file path or URL and returns the file extension. Unlike functions like tools::file_ext, this function handles both paths and URLs.

Usage

fileExt(text)

Arguments

text

Character. The full path or URL of the file.

Value

Character. The extension of the file. Returns an empty string if no extension is found.

Examples

fileExt("path/to/file.txt")  
fileExt("https://example.com/file.csv") 
fileExt("no_extension_file") 


Epiconcept-Paris/STRAP-epiuf documentation built on Aug. 5, 2024, 3:41 a.m.