outdent
fn
S outdent(S)(S str) if (isSomeString!S) @safe pureRemoves one level of indentation from a multi-line string.
This uniformly outdents the text as much as possible. Whitespace-only lines are always converted to blank lines.
Does not allocate memory if it does not throw.
Parameters
str | multi-line string |
Returns
outdented string
Throws
StringException if indentation is done with different sequences
of whitespace characters.
fn
S[] outdent(S)(return scope S[] lines) if (isSomeString!S) @safe pureRemoves one level of indentation from an array of single-line strings.
This uniformly outdents the text as much as possible. Whitespace-only lines are always converted to blank lines.
Parameters
lines | array of single-line strings |
Returns
lines[] is rewritten in place with outdented lines
Throws
StringException if indentation is done with different sequences
of whitespace characters.