code: public static String stripMargin(CharSequence self, char marginChar) {
          String s = self.toString();
          if (s.length() == 0) return s;
          try {
              StringBuilder builder = new StringBuilder();
              for (String line : readLines((CharSequence) s)) {
                  builder.append(stripMarginFromLine(line, marginChar));
                  builder.append("\n");
              }
              // remove the normalized ending line ending if it was not present
              if (!s.endsWith("\n")) {
                  builder.deleteCharAt(builder.length() - 1);
              }
              return builder.toString();
          } catch (IOException e) {
              /* ignore */
          }
          return s;
      }
docs: Strip leading whitespace/control characters followed by <tt>marginChar</tt> from
  every line in a CharSequence.
  <pre class="groovyTestCase">
  assert 'ABC\n123\n456' == '''ABC
  *123
  *456'''.stripMargin('*')
  </pre>
  
  @param self       The CharSequence to strip the margin from
  @param marginChar Any character that serves as margin delimiter
  @return the stripped String
  @see #stripMargin(String, char)
  @since 1.8.2