trimMargin method
Trim start margin of multiline string literal by depth (e.g. ''' hello'''.trimMargin() -> 'hello')
depth is the count of spaces (' ') before the actual start of the line
Implementation
String trimMargin([int depth = 4]) {
final margin = ' ' * depth;
return replaceFirst(margin, '').replaceAll('\n$margin', '\n');
}