capitalize {plu} | R Documentation |
Capitalization
Description
capitalize()
returns a character vector x
with the first
alphabetic character replaced with a capital form (if one exists).
Usage
capitalize(x)
plu_capitalize(x)
is_capital(x, strict = FALSE)
is_capitalized(x, strict = FALSE)
Arguments
x |
A character vector. |
strict |
If strict is |
Details
is_capital()
returns TRUE
if all characters are capital, FALSE
if
all characters are lowercase, and NA
if characters are mixed case or any
characters are caseless (e.g. numbers, punctuation marks, characters from a
unicase language like Arabic, Chinese or Hindi).
is_capitalized()
returns TRUE
if the first alphabetic character in a
string is capital, FALSE
if the first alphabetic character is lowercase,
and NA
if there are no alphabetic characters.
Value
capitalize()
returns a character vector of the same length as x
.
is_capital()
and is_capitalized()
return a logical vector of the same
length as x
.
Examples
capitalize(c("word", "a whole phrase"))
capitalize("preserving MIXED Case")
capitalize("... word")
is_capital(c("a", "A", "!"))
is_capital(c("aa", "AA", "!!"))
is_capital("Aa")
is_capitalized(c("a word", "A word", "a Word"))
is_capitalized("... A word")
is_capitalized("...")