StringIndentation extension
Extension methods for easier indentation of strings while preserving relative indentation.
- on
Methods
-
getIndentationLevel(
) → int - Returns the indentation level of this string.
-
indent(
int indentationLevel) → String -
Returns this string with
indentationLevel
applied while preserving relative indentation. -
indentBy(
int howMuch) → String -
Returns this string with indentation level changed by
howMuch
. -
trimMargin(
[String marginPrefix = '|']) → String -
Returns this string, but trims leading whitespace characters followed by the
given
marginPrefix
from each line. -
unindent(
) → String - Returns this string with all extra indentation stripped while preserving the relative indentation.