Skip to content

Left justify strings

Description

Return the string left justified in a string of length width.

Usage

<Expr>$str$pad_end(length, fill_char = " ")

Arguments

length Justify left to this length.
fill_char Fill with this ASCII character.

Details

Padding is done using the specified fill_char. The original string is returned if length is less than or equal to len(s).

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(a = c("cow", "monkey", NA, "hippopotamus"))
df$select(pl$col("a")$str$pad_end(8, "*"))
#> shape: (4, 1)
#> ┌──────────────┐
#> │ a            │
#> │ ---          │
#> │ str          │
#> ╞══════════════╡
#> │ cow*****     │
#> │ monkey**     │
#> │ null         │
#> │ hippopotamus │
#> └──────────────┘