Skip to contents

trim_ws() is an efficient function to trim leading and trailing white space from character vectors or strings.

Usage

trim_ws(str, ...)

# S3 method for class 'character'
trim_ws(x, ...)

# S3 method for class 'data.frame'
trim_ws(x, character_only = TRUE, ...)

# S3 method for class 'list'
trim_ws(x, character_only = TRUE, ...)

Arguments

str

Character vector, or a data frame.

...

Currently not used.

Value

Character vector, where trailing and leading white spaces are removed.

Examples

trim_ws("  no space!  ")
#> [1] "no space!"