On Windows, there were problems with lines not being split correctly

On Windows, the below comparison (if line == "---") did not trigger, because there were some line endings left in the string. I trimmed These remaining trailing whitespaces away.