Learn R Programming

rock (version 0.8.1)

split_long_lines: Split long lines

Description

This function splits long lines at a given number of characters, keeping words intact. It's basically a wrapper around strwrap().

Usage

split_long_lines(
  x,
  length = 60,
  splitString = rock::opts$get("utteranceMarker")
)

Value

A character vector.

Arguments

x

The string (e.g. a source)

length

The maximum length

splitString

The character to use to split lines.

Examples

Run this code
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."
    )
  )
);

Run the code above in your browser using DataLab