This function splits long lines at a given number of characters,
keeping words intact. It's basically a wrapper around strwrap()
.
split_long_lines(
x,
length = 60,
splitString = rock::opts$get("utteranceMarker")
)
The string (e.g. a source)
The maximum length
The character to use to split lines.
A character vector.
cat(
rock::split_long_lines(
paste0(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. ",
"Vestibulum et dictum urna. Donec neque nunc, lacinia vitae ",
"varius vitae, pretium quis nibh. Aliquam pulvinar, lacus ",
"sed varius vulputate, justo nibh blandit quam, ",
"nec sollicitudin velit augue eget erat."
)
)
);
#> Lorem ipsum dolor sit amet, consectetur adipiscing elit.
#> Vestibulum et dictum urna. Donec neque nunc, lacinia vitae
#> varius vitae, pretium quis nibh. Aliquam pulvinar, lacus
#> sed varius vulputate, justo nibh blandit quam, nec
#> sollicitudin velit augue eget erat.