Capitalizes character strings in different ways: first letter, each word, or title case.
Usage
strCap(x, method = c("first", "word", "title"))Details
The function uses Unicode-aware transformations from the stringi package.
For method = "title", common stopwords (e.g., "a",
"the", "of") remain lowercase unless they appear
as part of another word.
See also
stringi::stri_trans_totitle(),
stringi::stri_split_boundaries()
string-overview for an overview of all string utilities in pharos.
Examples
x <- c("hello world", "the lord of the rings")
# first letter
strCap(x, "first")
#> [1] "Hello World" "The Lord Of The Rings"
# each word
strCap(x, "word")
#> [1] "Hello World" "The Lord Of The Rings"
# title case
strCap(x, "title")
#> [1] "Hello World" "the Lord of the Rings"
