code: public static <T> T eachLine(CharSequence self, int firstLine, @ClosureParams(value=FromString.class, options={"String","String,Integer"}) Closure<T> closure) throws IOException {
          int count = firstLine;
          T result = null;
          for (String line : readLines(self.toString())) {
              result = callClosureForLine(closure, line, count);
              count++;
          }
          return result;
      }
docs: Iterates through this CharSequence line by line.  Each line is passed
  to the given 1 or 2 arg closure. If a 2 arg closure is found
  the line count is passed as the second argument.
  
  @param self    a CharSequence
  @param firstLine the line number value used for the first line (default is 1, set to 0 to start counting from 0)
  @param closure a closure (arg 1 is line, optional arg 2 is line number)
  @return the last value returned by the closure
  @throws java.io.IOException if an error occurs
  @see #eachLine(String, int, groovy.lang.Closure)
  @since 1.8.2