1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

string: fix bug and add tests for string.count

This commit is contained in:
Alvydas Vitkauskas
2019-08-03 23:24:03 +03:00
committed by Alexander Medvednikov
parent 93d27b0b9f
commit 331d6f98ee
2 changed files with 11 additions and 1 deletions

View File

@@ -462,7 +462,7 @@ pub fn (s string) count(substr string) int {
mut n := 0
mut i := 0
for {
i := s.index_after(substr, i)
i = s.index_after(substr, i)
if i == -1 {
return n
}