trim: Trim leading or trailing whitespaces

View source: R/trim.R

trimR Documentation

Trim leading or trailing whitespaces

Description

Trim leading or trailing whitespaces

Usage

trim(x, lead = TRUE, trail = TRUE)

Arguments

x

a character vector

lead

a boolean. If TRUE leading whitespaces will be trimed

trail

a boolean. If TRUE trailing whitespaces will be trimed

Value

a character vector

Author(s)

Jakob Gepp

See Also

Since R 3.5.1 there is trimws in the base package.

Examples

x <- c("  Hello world!", "  Hello world! ", "Hello world! ")
trim(x)
# [1] "Hello world!" "Hello world!" "Hello world!"


STATWORX/helfRlein documentation built on Feb. 12, 2024, 2:21 a.m.