Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

strtrim

Remove leading and trailing white space.


Description

Removes leading and trailing white space from a string.

Usage

strTrim(s)
deblank(s)

Arguments

s

character string or character vector

Details

strTrim removes leading and trailing white space from a string or from all strings in a character vector.

deblank removes trailing white space only from a string or from all strings in a character vector.

Value

A character string or character vector with (leading and) trailing white space.

See Also

Examples

s <- c("  abc", "abc   ", " abc ", " a b c ", "abc", "a b c")
strTrim(s)
deblank(s)

pracma

Practical Numerical Math Functions

v2.3.3
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.