Skip to content

Convert a string to titlecase

Source code

Description

Transform to titlecase variant.

Usage

<Expr>$str$to_titlecase()

Details

This method is only available with the "nightly" feature. See polars_info() for more details.

Value

A polars expression

Examples

library("polars")


pl$select(
  pl$lit(c("hello there", "HI, THERE", NA))$str$to_titlecase()
)$to_series()
#> shape: (3, 1)
#> ┌─────────────┐
#> │ literal     │
#> │ ---         │
#> │ str         │
#> ╞═════════════╡
#> │ Hello There │
#> │ Hi, There   │
#> │ null        │
#> └─────────────┘