R/str_right.R

Defines functions str_right

Documented in str_right

#' Return the n number of characters from the right
#'
#' Wrapper convenience function
#'
#' @param x String character to pass through
#' @param n Integer specifying the number of characters to return from the right.
#'
#' @importFrom stringr str_sub
#'
#' @examples
#' str_right("Wittgenstein", 5)
#'
#' @export
str_right <- function(x, n){
  nx <- n-1
  str_sub(x,nchar(x)-nx,nchar(x))
}
martinctc/textworks documentation built on Oct. 5, 2022, 8:09 p.m.