case: Convert case of a string.

Description Usage Arguments Examples

Description

Convert case of a string.

Usage

1
2
3
4
5
6
7
str_to_upper(string, locale = "en")

str_to_lower(string, locale = "en")

str_to_title(string, locale = "en")

str_to_sentence(string, locale = "en")

Arguments

string

String to modify

locale

Locale to use for translations. Defaults to "en" (English) to ensure consistent default ordering across platforms.

Examples

1
2
3
4
5
6
7
8
9
dog <- "The quick brown dog"
str_to_upper(dog)
str_to_lower(dog)
str_to_title(dog)
str_to_sentence("the quick brown dog")

# Locale matters!
str_to_upper("i") # English
str_to_upper("i", "tr") # Turkish

Example output

[1] "THE QUICK BROWN DOG"
[1] "the quick brown dog"
[1] "The Quick Brown Dog"
[1] "The quick brown dog"
[1] "I"
[1] "<U+0130>"

stringr documentation built on May 2, 2019, 11:03 a.m.