Learn R Programming

PTXQC (version 1.0.14)

hasFileSuffix: Checks if filepath ends in suffix. If suffix does not start with a '.' it is prepended automatically.

Description

Checks if filepath ends in suffix. If suffix does not start with a '.' it is prepended automatically.

Usage

hasFileSuffix(filepath, suffix)

Value

TRUE if yes, FALSE otherwise

Arguments

filepath

A relative or absolute path to a file, whose suffix is checked

suffix

This is the suffix we expect (the '.' is prepended internally if missing)

Examples

Run this code
  hasFileSuffix("bla.txt", "txt")    # TRUE
  hasFileSuffix("bla.txt", ".txt")   # TRUE
  hasFileSuffix("bla.txt", "doc")    # FALSE
  hasFileSuffix("bla.txt", ".doc")   # FALSE
  hasFileSuffix("fo", ".doc")        # FALSE
  hasFileSuffix("", ".doc")          # FALSE
  hasFileSuffix("foo", "")           # FALSE

Run the code above in your browser using DataLab