str_trunc

0th

Percentile

Truncate a character string.

Truncate a character string.

Usage
str_trunc(string, width, side = c("right", "left", "center"),
  ellipsis = "...")
Arguments
string

A character vector.

width

Maximum width of string.

side, ellipsis

Location and content of ellipsis that indicates content has been removed.

See Also

str_pad() to increase the minimum width of a string.

Aliases
  • str_trunc
Examples
# NOT RUN {
x <- "This string is moderately long"
rbind(
  str_trunc(x, 20, "right"),
  str_trunc(x, 20, "left"),
  str_trunc(x, 20, "center")
)

# }
Documentation reproduced from package stringr, version 1.4.0, License: GPL-2 | file LICENSE

Community examples

Looks like there are no examples yet.