Skip to contents

str_title_case() converts string to title case, capitalizing only the first letter of each word while ignoring articles, prepositions, and conjunctions

Usage

str_title_case(string)

Arguments

string

Input vector. Either a character vector, or something coercible to one.

Value

A character vector the same length as the string and in title case.

Details

Please note that str_title_case() is different from stringr::str_to_title() which converts to title case, where only the first letter of each word is capitalized.

Examples


words <- "the quick brown fox jumps over a lazy dog"

str_title_case(words)
#> [1] "The Quick Brown Fox Jumps over a Lazy Dog"

str_to_title(words)
#> [1] "The Quick Brown Fox Jumps Over A Lazy Dog"

words <- "A journey through the history of music"

str_title_case(words)
#> [1] "A Journey through the History of Music"

str_to_title(words)
#> [1] "A Journey Through The History Of Music"