R/hasFinalSlash.R

Defines functions hasFinalSlash

Documented in hasFinalSlash

#' Does a String End with Slash?
#' 
#' @param x vector of character
#' @return vector of boolean being \code{TRUE} at indices where the elements in
#'   \code{x} end with a slash ("/")
#' @export
#' @examples
#' (is_directory <- hasFinalSlash(c("a", "b/", "c", "d/")))
hasFinalSlash <- function(x)
{
  n <- nchar(x)
  substr(x, n, n) == "/"
}
KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.