snowflake.snowpark.functions.rtrimmed_length

snowflake.snowpark.functions.rtrimmed_length(string_expr: Union[snowflake.snowpark.column.Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.45.0/src/snowflake/snowpark/_functions/scalar_functions.py#L5151-L5168)

Returns the length of the input string after removing trailing whitespace characters.

Parameters:

string_expr (ColumnOrName) – The string expression to calculate the right-trimmed length for.

Returns:

The length of the string after removing trailing whitespace.

Return type:

Column

Examples::
>>> df = session.create_dataframe([" ABCD ", "hello world   ", "   test", "no_spaces", ""], schema=["a"])
>>> df.select(rtrimmed_length(df["a"]).alias("result")).collect()
[Row(RESULT=5), Row(RESULT=11), Row(RESULT=7), Row(RESULT=9), Row(RESULT=0)]
Copy
Language: English