SplitScript reference / String / padStart
String.padStart
Method
String.padStart(width: u32, fill: char) -> String
Pads the beginning 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 before 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 before the original string.
Effects: allocates
Runtime behavior: available everywhere; synchronous
Examples
Zero-pad a numeric identifier
let identifier = "7".padStart(3, '0')