ez.trim: Merge multiple spaces to single space in the middle, and...

ez.trimR Documentation

Merge multiple spaces to single space in the middle, and remove trailing/leading spaces

Description

underlying function is gsub with regular expression

Usage

ez.trim(s, how = 4)

Arguments

s

a string or a data frame. if data frame, how will be ignored/forced to be 'both'

how

a num 1=left only; 2=right only; 3=left and right; 4 (default)=left and right and merge middle

See Also

trimws

Examples

 "Hi        buddy        what's up    Bro"  --> "Hi buddy what's up bro"
For portability, whitespace is taken as the character class [ \t\r\n] (space, horizontal tab, line feed, carriage return).

jerryzhujian9/ezmisc documentation built on March 9, 2024, 12:44 a.m.