indent

Adds one level of indentation for a multi-line string. Adds indentSize spaces to each non-empty line.

S
indent
(
S
)
(
S str
,
in size_t indentSize = 4
)
if (
isSomeString!S
)

Return Value

Type: S

indented string

Examples

assert("a\nb".indent == "    a\n    b");
assert("a\nb\n\n".indent == "    a\n    b\n\n");
assert("a\nb\n".indent(2) == "  a\n  b\n");

Meta