Replaces a list of separator characters
(e.g. ".", "_", HTML tags) with spaces, trims leading and
trailing whitespace, collapses internal whitespace, and optionally applies
proper case.
Usage
str_aes(
vector,
characterlist = c(".", "_", "-", ",", "$", "<p>", "</p>", "<br>", "<br/>", "<B>",
"</B>", "<BR/>", "|", "/", " "),
proper = TRUE
)Arguments
- vector
Character vector to clean.
- characterlist
Character vector of strings to treat as separators, each replaced by a single space. Defaults to common punctuation and HTML tags including
".","_","-","<p>","<br>"," ", and others.- proper
Logical. If
TRUE, capitalises the first letter and lowercases the rest of each string. Default isTRUE.
Value
A character vector of the same length as vector with
separators replaced, whitespace normalised, and optional proper casing.
Examples
vector <- c("TES.T", "TES<p>T", "TES T")
str_aes(vector = vector)
#> [1] "Tes t" "Tes t" "Tes t"
str_aes(vector = vector, proper = FALSE)
#> [1] "TES T" "TES T" "TES T"
str_aes(vector = vector, proper = TRUE)
#> [1] "Tes t" "Tes t" "Tes t"