getIndentationLevel method

int getIndentationLevel (String line)

Returns the tree level for the line.

Implementation

int getIndentationLevel(String line) {
  int i = 0;
  while (line[i] == " ") {
    i++;
  }
  return (i / 2).round();
}