View source: R/replace_file_extension.R
replace_file_extension | R Documentation |
This function replaces the file extension of a given filename with a specified new extension. It validates the input to ensure the filename and the new extension are single character strings. Then, it replaces the old extension with the new one and returns the modified filename.
replace_file_extension(filename, new_extension)
filename |
The input filename as a character string. |
new_extension |
The new file extension to replace the old one (including the dot, e.g., ".bib"). |
A character string representing the filename with the replaced file extension.
Ulrich Matter umatter@protonmail.com
## Not run:
# Replace the file extension of a text file with a BibTeX extension
new_filename <- replace_file_extension("example_document.txt", ".bib")
print(new_filename) # "example_document.bib"
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.