rtrim: String trimming.

Description Usage Arguments Details Value See Also Examples

View source: R/utils.R

Description

Trims whitespace off the ends of strings.

Usage

1
2
3
4
5
rtrim(s, chars = " \n\t\r")

ltrim(s, chars = " \n\t\r")

trim(s, chars = " \n\t\r")

Arguments

s

Character array to be trimmed.

chars

Characters to be trimmed.

Details

rtrim trims the right end of the string, ltrim trims the left end of the string and trim trims both ends of the string.

Value

Trimmed version of the character array.

See Also

sub

Examples

1
2
3
4
5
6
7
8
s <- "   garbagexxxx"
print(rtrim(s))
print(rtrim(s, 'x'))
print(ltrim(s))
print(ltrim(s, 'x'))
print(trim(s))
print(trim(s,'x'))
print(trim(s,' x'))

tunelipt/wutils documentation built on Nov. 5, 2019, 11:01 a.m.