R/unindent.R

Defines functions unindent

Documented in unindent

#' Unindents text
#' @param text one or more lines of text
#' @return unindented lines of text
#' @author Richèl J.C. Bilderbeek
#' @export
unindent <- function(
  text
) {
  if (length(text) == 0) return(text)
  stringr::str_sub(
    text,
    1 + min(nchar(stringr::str_match(text, "^([:space:]*)")[, 1]))
  )
}

Try the beautier package in your browser

Any scripts or data that you put into this service are public.

beautier documentation built on Nov. 2, 2023, 5:08 p.m.