umx_trim: Trim whitespace surrounding a string.

umx_trimR Documentation

Trim whitespace surrounding a string.

Description

Returns string without leading or trailing whitespace, like the php function. See also built-in base::trimws() does the same.

Usage

umx_trim(string, removeThis = NULL)

Arguments

string

to trim

removeThis

if not NULL then this regular expression is removed wherever found in 'string'

Value

  • string

References

See Also

base::trimws()

Other String Functions: umx_explode_twin_names(), umx_explode(), umx_grep(), umx_names(), umx_paste_names(), umx_rot(), umx_str_chars(), umx_str_from_object(), umx

Examples

umx_trim(" dog") # "dog"
trimws(" dog ", "l") # added by R in v 3.3.0
umx_trim("dog ") # "dog"
umx_trim("\t dog \n") # "dog"
umx_trim("xlsx dog.xlsx", "\\.?xlsx ?") # "dog"

umx documentation built on May 29, 2024, 5:40 a.m.