Capitalize the First Letter of a String
Capitalize the first letter of each element of the string vector.
StrCap(x, method=c("first", "word", "title"))
x |
string to be capitalized. |
method |
one out of |
Returns a vector of charaters with the first letter capitalized
Charles Dupont <charles.dupont@vanderbilt.edu>, Andri Signorell <andri@signorell.net> (methods word and title)
# capitalize first character StrCap(c("Hello", "bob", "daN")) # but not all... StrCap(c("Hello bob, how are you?", "And you, DANIEL?")) # wordwise StrCap(c("Capitalize all words in titles of publications and documents", "but Up and UP, not all and all", NA), method="word") # wordwise omitting the ones listed above StrCap(c("Capitalize all words in titles of publications and documents", "but Up and UP, not all and all", NA), method="title") # do not touch non alphabetic characters z <- c("Lorem ipsum dolor", "-- sit amet", "consectetur --", " adipiscing elit ", "sed,.--(do) / +-*eiusmod") StrCap(z, method="title")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.