Learn R Programming

ribiosUtils (version 1.5-6)

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")

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

Value

Trimmed string(s)

Details

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

Examples

Run this code
# NOT RUN {
myStrings <- c("This is a fine day\n",
               " Hallo Professor!",
               "  NUR DER HSV  ")
trim(myStrings)

# }

Run the code above in your browser using DataLab