Description
Removes leading and/or trailing space(s) from a character
vector value. By default, it removes only trailing
spaces. In order to trim both leading and trailing
spaces, pass TRUE
to both leading
and
trailing
arguments.Usage
trim.space(x, leading = FALSE, trailing = TRUE,
re = "[:space:]", ...)
Arguments
x
a character vector which needs whitespace
trimming
leading
a logical value indicating if leading
spaces should be removed (defaults to FALSE
)
trailing
a logical value indicating if trailing
spaces should be removed (defaults to TRUE
)
re
a character value containing a regex that
defines a space character
...
additional arguments for gsub
function Value
- a character vector with removed spaces