Learn R Programming

spatstat.utils (version 3.2-4)

capitalise: Make Each Word Start with a Capital Letter

Description

Given a character string or vector of character strings containing words, change the start of each word to a capital letter.

Usage

capitalise(s, strict = FALSE)

Value

A character string or character vector of the same length as s.

Arguments

s

Character string or vector of character strings.

strict

Logical. If TRUE, all subsequent letters after the first letter in each word will be coerced to lower case.

Author

Originally documented in base R. Code copied by Adrian Baddeley Adrian.Baddeley@curtin.edu.au.

Details

Each entry of s is split into separate words separated by the space character. Then the first letter of each word is coerced to a capital letter using toupper, and if strict=TRUE, subsequent letters are coerced to lower case using tolower. Then the words are replaced in their original positions in s.

See Also

Examples

Run this code
  a <-  c("worKers", "of tHe", "worLd unIte")
  capitalise(a)
  capitalise(a, TRUE)

Run the code above in your browser using DataLab