Right justify strings
Description
Return the string right justified in a string of length
length
.
Usage
<Expr>$str$pad_start(length, fill_char = " ")
Arguments
length
|
Pad the string until it reaches this length. Strings with length equal to or greater than this value are returned as-is. Can be integer or expression. |
fill_char
|
Fill with this ASCII character. |
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(a = c("cow", "monkey", NA, "hippopotamus"))
df$select(pl$col("a")$str$pad_start(8, "*"))
#> shape: (4, 1)
#> ┌──────────────┐
#> │ a │
#> │ --- │
#> │ str │
#> ╞══════════════╡
#> │ *****cow │
#> │ **monkey │
#> │ null │
#> │ hippopotamus │
#> └──────────────┘