Fix wrong result of countLines() (#6371)
This commit is contained in:
parent
bca3bedc47
commit
94e336fe85
2 changed files with 14 additions and 1 deletions
|
|
@ -776,7 +776,8 @@ proc countLines*(s: string): int {.noSideEffect,
|
|||
##
|
||||
## In this context, a line is any string seperated by a newline combination.
|
||||
## A line can be an empty string.
|
||||
var i = 1
|
||||
result = 1
|
||||
var i = 0
|
||||
while i < s.len:
|
||||
case s[i]
|
||||
of '\c':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue