SplitScript reference / String / padEnd

String.padEnd

Method

String.padEnd(width: u32, fill: char) -> String

Pads the end of this string to a minimum Unicode-scalar length.

The original string is returned unchanged when it already contains at least width Unicode scalar values. Otherwise fill is repeated after it. This measures scalar values, not UTF-8 bytes or terminal columns.

Parameters

  • width: The minimum number of Unicode scalar values in the result.
  • fill: The character repeated after the original string.

Effects: allocates

Runtime behavior: available everywhere; synchronous

Examples

Space-pad a diagnostic label

let label = "Split".padEnd(9, ' ')