indent method

String indent(
  1. int indentationLevel
)

Returns this string with indentationLevel applied while preserving relative indentation.

For example, the input:

Hello World

applied with indentationLevel of 3 results in:

Hello

World

If the starting indentation level is higher than indentationLevel, the value will be unindented accordingly.

For example, the input:

   Hello
  World

applied with indentationLevel of 3 also results in:

Hello

World

Implementation

String indent(int indentationLevel) =>
    Indentation(this).indent(indentationLevel);