Strip leading and trailing characters
Description
Remove leading and trailing characters.
Usage
<Expr>$str$strip_chars(matches = NULL)
Arguments
matches
|
The set of characters to be removed. All combinations of this set of
characters will be stripped. If NULL (default), all
whitespace is removed instead. This can be an Expr.
|
Details
This function will not strip any chars beyond the first char not
matched. strip_chars()
removes characters at the beginning
and the end of the string. Use strip_chars_start()
and
strip_chars_end()
to remove characters only from left and
right respectively.
Value
Expr of String lowercase chars
Examples
library("polars")
df = pl$DataFrame(foo = c(" hello", "\tworld"))
df$select(pl$col("foo")$str$strip_chars())
#> shape: (2, 1)
#> ┌───────┐
#> │ foo │
#> │ --- │
#> │ str │
#> ╞═══════╡
#> │ hello │
#> │ world │
#> └───────┘
#> shape: (2, 1)
#> ┌─────┐
#> │ foo │
#> │ --- │
#> │ str │
#> ╞═════╡
#> │ o │
#> │ wo │
#> └─────┘