R/upper.R

Defines functions strs_upper

Documented in strs_upper

#' Convert string to uppercase
#'
#' `strs_upper` converts each element of a character vector to uppercase, based
#' on the specified locale. It is similar to Python's `str.upper()` method.
#'
#' @param string A character vector to be converted to uppercase.
#' @param locale A character string representing the locale to be used for the
#' conversion.
#' @return A character vector of the same length as `string`, with each element
#' converted to uppercase.
#' @examples
#' strs_upper("hello world")
#' strs_upper("Àpfel", locale = "de")
#' @seealso [Python str.upper() documentation](https://docs.python.org/3/library/stdtypes.html#str.upper)
#' @export
strs_upper <- function(string, locale = "en") {
  stringi::stri_trans_toupper(string, locale)
}

Try the strs package in your browser

Any scripts or data that you put into this service are public.

strs documentation built on Sept. 11, 2024, 6:44 p.m.