Converts the input to a character vector and ensures it starts with an upper case letter and ends with the specified punctuation mark.
Arguments
- x
Input to be converted to sentence case, typically a character vector.
- punctuation_mark
Punctuation mark to be appended to
x. A character scalar.
Details
Note that this function doesn't alter any characters in x other than the first and the last one.
See also
stringr::str_to_sentence() to convert a character vector to all lowercase except for the first character. Note that this also includes lowercasing proper nouns, abbreviations etc.
snakecase::to_sentence_case() that builds upon stringr::str_to_sentence() but offers additional options to finetune the conversion. Note that
abbreviations have to be manually specified in order to be preserved in upper case.
Other string functions:
as_chr(),
as_comment_str(),
as_env_var_name(),
as_line_feed_chr(),
as_str(),
capitalize_first(),
dsv_colnames(),
enum_str(),
escape_lf(),
fuse_regex(),
phrase_nr(),
wrap_chr()
Examples
pal::sentenceify("no verb, no sentence")
#> [1] "No verb, no sentence."
# punctuation mark won't be duplicated if already existing
pal::sentenceify(c("I've made my point",
"good point."))
#> [1] "I've made my point." "Good point."
