Learn R Programming

ribiosUtils (version 1.7.7)

trim: Trim leading and tailing spaces from string

Description

The function trims leading and/or tailing spaces from string(s), using C function implemented in the BIOS library.

Usage

trim(x, left = " \n\r\t", right = " \n\r\t")

Value

Trimmed string(s)

Arguments

x

A character string, or a vector of strings

left

Characters that are trimmed from the left side.

right

Characters that are trimmed from the right side

Author

Jitao David Zhang <jitao_david.zhang@roche.com>

Details

left and right can be set to NULL. In such cases no trimming will be performed.

Examples

Run this code

myStrings <- c("This is a fine day\n",
               " Hallo Professor!",
               "  NUR DER HSV  ")
trim(myStrings)

Run the code above in your browser using DataLab