add_period: Add a Period If Necessary

View source: R/text_formatting.R

add_periodR Documentation

Add a Period If Necessary

Description

Add a period at the end of a sentence if necessary.

Usage

add_period(str)

Arguments

str

A string, ending in a sentence.

Details

Trim any whitespace at the end, and if the line does not end with punctuation, add a period.

Value

A string ending in punctuation.

Examples

add_period("This needs a period")
add_period("This does not need another period.")
add_period("Fix spaces at the end   ")
add_period("Shouldn't I omit a period if the sentence already ends with other punctuation?  ")


jonathan-g/semestr documentation built on Jan. 23, 2025, 3:10 p.m.