Skip to content

Left justify strings

Source code

Description

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

Usage

<Expr>$str$pad_end(width, fillchar = " ")

Arguments

width Justify left to this length.
fillchar Fill with this ASCII character.

Details

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

Value

Expr of String

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 │
#> └──────────────┘