mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: fix bug with string.split_into_lines, when lines have extra CR's at their end (#16620)
This commit is contained in:
parent
7091010a53
commit
eb88f7e255
@ -849,11 +849,9 @@ pub fn (s string) split_into_lines() []string {
|
||||
return res
|
||||
}
|
||||
mut start := 0
|
||||
mut end := 0
|
||||
for i := 0; i < s.len; i++ {
|
||||
if s[i] == 10 {
|
||||
end = if i > 0 && s[i - 1] == 13 { i - 1 } else { i }
|
||||
res << if start == end { '' } else { s[start..end] }
|
||||
res << if start == i { '' } else { s[start..i].trim_right('\r') }
|
||||
start = i + 1
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user