std_chr() standardizes character vectors to ASCII text with no unnecessary
whitespace and a given case. By default, it will retain newlines inside text,
though it will condense consecutive newlines and any carriage returns into a
single newline.
Usage
std_chr(
x,
case = c("upper", "lower", "title", "sentence"),
keep_inner_newlines = TRUE,
na = "^$"
)Arguments
- x
A character vector
- case
The case to convert to.
NULLwill skip case conversion.- keep_inner_newlines
Whether to retain line breaks inside text.
FALSEwill treat newlines and carriage returns identically to any other whitespace.- na
Regex patterns to consider
NA. Passed tostringr::str_detect(). Can be a vector of patterns.