Learn R Programming

pracma (version 1.8.8)

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

Value

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

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.

See Also

strjust

Examples

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

Run the code above in your browser using DataLab