Very simple but often applicable function to retrieve or change the file name extension (from say file.lst to file.mod)
fnExtension(fn, ext)
A text string
fnExtension("file.lst",".mod")
#> [1] "file.mod"
fnExtension("file.lst","mod")
#> [1] "file.mod"
fnExtension("file.lst","..mod")
#> [1] "file..mod"
fnExtension("file.lst",cc(.mod,xml))
#> [1] "file.mod" "file.xml"
fnExtension(cc(file1.lst,file2.lst),cc(.xml))
#> [1] "file1.xml" "file2.xml"
fnExtension(cc(file1.lst,file2.lst),cc(.xml,.cov))
#> [1] "file1.xml" "file2.cov"
fnExtension("file.lst","")
#> [1] "file"
fnExtension("file.lst")
#> [1] "lst"