Wrap a string to within a maximum width
wrap_string(str, max_width, hard = FALSE)wrap_txt(txt, max_width, hard = FALSE)
A string (wrap_string
or character vector (wrap_txt
) containing
the hard or soft word-wrapped content.
character(1). String to be wrapped
numeric(1). Maximum width, in characters, that the text should be wrapped at.
logical(1). Should hard wrapping (embedding newlines in
the incoming strings) or soft (breaking wrapped strings into vectors
of length >1) be used. Defaults to FALSE
(i.e. soft wrapping).
character. Vector of strings that should be (independently) text-wrapped.
Word wrapping happens as with base::strwrap
with the following exception: individual words which are longer
than max_width
are broken up in a way that fits with the rest of the
word wrapping.