R/misc.R

Defines functions formatText

#' @importFrom utils capture.output
formatText <- function(text, n = 20L, truncated = "<...>") {

  result <- if (nchar(text) < n)
    text
  else
    paste(text, truncated)

  encodeString(result)
}
rstudio/rstudioapi documentation built on Nov. 8, 2024, 5:26 a.m.