outdent

fnS outdent(S)(S str) if (isSomeString!S) @safe pure

Removes 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

strmulti-line string

Returns

outdented string

Throws

StringException if indentation is done with different sequences

of whitespace characters.

fnS[] outdent(S)(return scope S[] lines) if (isSomeString!S) @safe pure

Removes 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

linesarray 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.