Learn R Programming

GimmeMyStats (version 1.0.0)

to_title: Convert Strings to Title Case

Description

Converts the first character of each string to uppercase and the rest to lowercase.

Usage

to_title(x)

Value

A character vector with the same length as x, where each element has its first character converted to uppercase and remaining characters are preserved as-is.

Arguments

x

A character vector or a list containing strings to convert to title case.

Examples

Run this code
to_title(c("hELLO", "WoRLD", "R"))
# Returns: "Hello" "World" "R"

Run the code above in your browser using DataLab