def pad_right

bend-kit-tty@0.1.0.1 · text.bend:42

import bend-kit-tty@0.1.0.1/text.bend as Text
import Base

42# Append spaces until text occupies at least cols display columns.
43def pad_right(+text: String, +cols: U32) -> String:
44  +w = width(text)
45  +n = Bool.pick(U32, U32.is_lt(w, cols), (cols - w : U32), 0)
46  String.append(text, String.repeat(" ", U32.to_nat(n)))

Uses (9)

Used by (1)