String.trimIndent
trimIndent($options={}) -> string
Description
Remove all indentation whitespace from a string.
If options is -keepRelative
, it will only remove the excess indentation, while retaining the relative indentation between lines.
$text = ''' Line 1 Line 2 Line 3 ''' $text.trimIndent() //= 'Line 1\nLine 2\nLine 3' $text.trimIndent(-keepRelative) //= 'Line 1\n Line 2\n Line 3'