Closed Ngo-The-Trung closed 7 years ago
I commented in the issue, but as is, this has crashes because trimmed.nth(pos) is not equivalent to trimmed[pos], since pos is in bytes and nth is in characters. You can end up doing things like doing nth(pos) where pos is bigger than the number of chars in the string.
I implemented an equivalent in master. The larger issue of needing to handle whitespace here, and the general approach is correct though and I based my solution on it. Thanks again for the pr.
This correct counts lines such as
as comments