Last data update: 2014.03.03

R: Trim whitespace from start and end of string.
str_trimR Documentation

Trim whitespace from start and end of string.

Description

Trim whitespace from start and end of string.

Usage

str_trim(string, side = c("both", "left", "right"))

Arguments

string

A character vector.

side

Side on which to remove whitespace (left, right or both).

Value

A character vector.

See Also

str_pad to add whitespace

Examples

str_trim("  String with trailing and leading white space\t")
str_trim("\n\nString with trailing and leading white space\n\n")

Results