padLeft

Pads the left-hand margin of a multi-line string with the given text

string
padLeft
(
string bodyText
,
string withText
)

Parameters

bodyText string

the text to pad

withText string

the padding text

Return Value

Type: string

the padded text

Examples

Tests out the left-padding of text with a custom text segment

    string input = `Hello
World
`;

    string output = padLeft(input, "%");

    string[] output_segments = output.split("\n");
    writeln(output_segments);
    assert(output_segments[0] == "%Hello");
    assert(output_segments[1] == "%World");
    assert(output_segments[2] == "%");

Meta