Skip to main content
Version: 1.7.1

Expr.str.strip_chars

def strip_chars(characters: td_IntoExpr = None) -> Expr

Categories: string

Trim string values.

Parameters

parameter
characters

Characters to trim from start and end of the string. All characteres in the given string are removed, regardless the order. Default is whitespace.

Examples

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("a"), td.col("a")
.str.strip_chars("a ").alias("strip_chars"))
>>>
┌─────────────────────────────────┬─────────────┐
│ a ┆ strip_chars │
------
strstr
╞═════════════════════════════════╪═════════════╡
│ acba cda … ┆ cba cd │
│ xy z ┆ xy z │
│ null ┆ null │
└─────────────────────────────────┴─────────────┘