R/misc.R
hasFileSuffix.Rd
Checks if filepath ends in suffix (ignoring lower/upper case differences). If suffix does not start with a '.' it is prepended automatically.
hasFileSuffix(filepath, suffix)
A relative or absolute path to a file, whose suffix is checked
This is the suffix we expect (the '.' is prepended internally if missing)
TRUE if yes, FALSE otherwise
hasFileSuffix("bla.txt", "txt") # TRUE
#> [1] TRUE
hasFileSuffix("bla.txt", ".txt") # TRUE
#> [1] TRUE
hasFileSuffix("bla.txt", ".TXT") # TRUE
#> [1] TRUE
hasFileSuffix("foo", "") # TRUE
#> [1] TRUE
hasFileSuffix("", "") # TRUE
#> [1] TRUE
hasFileSuffix("bla.txt", "doc") # FALSE
#> [1] FALSE
hasFileSuffix("bla.txt", ".doc") # FALSE
#> [1] FALSE
hasFileSuffix("fo", ".doc") # FALSE
#> [1] FALSE
hasFileSuffix("", ".doc") # FALSE
#> [1] FALSE