
Last chance! 50% off unlimited learning
Sale ends in
"left"
deletes only leading whitespaces, "right"
only trailing.
Designed for users who were socialized by SQL.StrTrim(x, pattern = " \t\n", method = "both")
"both"
(default), "left"
, "right"
. Determines on which side the string should be trimmed.trimws
, nchar
, match
, grep
, regexpr
, substr
, sub
, gsub
,
StrTrunc
, StrDist
StrTrim("Hello world! ")
StrTrim("Hello world! ", method="left")
StrTrim("Hello world! ", method="right")
# user defined pattern
StrTrim("..Hello ... world! ", pattern="\\.")
Run the code above in your browser using DataLab