trimMargin method
Returns this string, but trims leading whitespace characters followed by the
given marginPrefix
from each line.
Also removes the first and last lines if they are blank, i.e. they only contain whitespace characters.
For example, given that the marginPrefix
is "|" (the default), the input:
| Hello
| there
| World
will become:
Hello there World
Leaves lines that don't contain marginPrefix
untouched.
Implementation
String trimMargin([String marginPrefix = '|']) =>
Indentation(this).trimMargin(marginPrefix);