R: Backport of trimws for R < 3.3.0

trimws {backports} | R Documentation

## Backport of trimws for R < 3.3.0

### Description

See the original description in `base::trimws`.

### Usage

    trimws(x, which = c("both", "left", "right"))

### Examples

    # get function from namespace instead of possibly getting
    # implementation shipped with recent R versions:
    bp_trimws = getFromNamespace("trimws", "backports")
    bp_trimws(c("  a  ", "b  ", "  c"))

    bp_trimws(c("  a  ", "b  ", "  c"), which = "left")

[Package backports version 1.1.2 Index]