code: public static String stripIndent(CharSequence self) {
          String s = self.toString();
          if (s.length() == 0) return s;
          int runningCount = -1;
          try {
              for (String line : readLines((CharSequence) s)) {
                  // don't take blank lines into account for calculating the indent
                  if (isAllWhitespace((CharSequence) line)) continue;
                  if (runningCount == -1) runningCount = line.length();
                  runningCount = findMinimumLeadingSpaces(line, runningCount);
                  if (runningCount == 0) break;
              }
          } catch (IOException e) {
              /* ignore */
          }
          return stripIndent(s, runningCount == -1 ? 0 : runningCount);
      }
docs: Strip leading spaces from every line in a CharSequence. The
  line with the least number of leading spaces determines
  the number to remove. Lines only containing whitespace are
  ignored when calculating the number of leading spaces to strip.
  <pre class="groovyTestCase">
  assert '  A\n B\nC' == '   A\n  B\n C'.stripIndent()
  </pre>
  
  @param self     The CharSequence to strip the leading spaces from
  @return the stripped toString() of the CharSequence
  @see #stripIndent(String)
  @since 1.8.2