Vectorized over str
and pattern
.
stri_trim
is a convenience wrapper over stri_trim_left
and stri_trim_right
.
Contrary to many other string processing libraries,
our trimming functions are universal. The class of characters
to be retained or trimmed can be adjusted.
For replacing pattern matches with
an arbitrary replacement string, see stri_replace
.
Trimming can also be used where you would normally rely on
regular expressions. For instance, you may get
'23.5'
out of 'total of 23.5 bitcoins'
.
For trimming white-spaces, please note the difference
between Unicode binary property `\p{Wspace}
` (more universal)
and general character category `\p{Z}
`,
see stringi-search-charclass.