Learn R Programming

strs (version 0.1.0)

strs_capitalize: Capitalize the first character of each sentence

Description

This function capitalizes the first character of each string in a given string, based on the specified locale. This is similar to Python's str.capitalize() method.

Usage

strs_capitalize(string, locale = "en")

Value

A character vector of the same length as string, where each element is the capitalized version of the corresponding element in string.

Arguments

string

A character vector where each element is a string to be capitalized.

locale

A character string representing the locale to be used for capitalization. Defaults to "en" (English). The locale affects the rules for identifying sentences in the string.

See Also

Examples

Run this code
strs_capitalize("hello world")

Run the code above in your browser using DataLab