-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
35 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
#' Convert case of a string. | ||
#' | ||
#' @param string String to modify | ||
#' @param locale Locale to use for translations. | ||
#' @param locale Locale to use for translations. Defaults to "en" (English) | ||
#' to ensure consistent default ordering across platforms. | ||
#' @examples | ||
#' dog <- "The quick brown dog" | ||
#' str_to_upper(dog) | ||
#' str_to_lower(dog) | ||
#' str_to_title(dog) | ||
#' | ||
#' # Locale matters! | ||
#' str_to_upper("i", "en") # English | ||
#' str_to_upper("i") # English | ||
#' str_to_upper("i", "tr") # Turkish | ||
#' @name case | ||
NULL | ||
|
||
#' @export | ||
#' @rdname case | ||
str_to_upper <- function(string, locale = "") { | ||
str_to_upper <- function(string, locale = "en") { | ||
stri_trans_toupper(string, locale = locale) | ||
} | ||
#' @export | ||
#' @rdname case | ||
str_to_lower <- function(string, locale = "") { | ||
str_to_lower <- function(string, locale = "en") { | ||
stri_trans_tolower(string, locale = locale) | ||
} | ||
#' @export | ||
#' @rdname case | ||
str_to_title <- function(string, locale = "") { | ||
str_to_title <- function(string, locale = "en") { | ||
stri_trans_totitle(string, opts_brkiter = stri_opts_brkiter(locale = locale)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.