Skip to contents

This function checks if a string ends with a newline character. If not, it adds one.

Usage

withLineEnd(x)

Arguments

x

A string.

Value

The input string with a newline character at the end if it was not already present.

Examples

cat(withLineEnd("Hello"))
#> Hello