convert_newlines_to_linebreaks: Replace the newline character with a line break

Description Usage Arguments Examples

View source: R/utils.R

Description

Replace the newline character with a line break

Usage

1

Arguments

text

A character vector

Examples

1
2
3
4
5
styler:::convert_newlines_to_linebreaks("x\n2")
# a simple strsplit approach does not cover both cases
unlist(strsplit("x\n\n2", "\n", fixed = TRUE))
unlist(strsplit(c("x", "", "2"), "\n", fixed = TRUE))
styler:::convert_newlines_to_linebreaks(c("x", "2"))

krlmlr/styler documentation built on Oct. 25, 2020, 8:13 a.m.