BugFix for short lists

This commit is contained in:
Vitor Pamplona
2024-02-05 20:26:37 -05:00
parent 248bdffd50
commit 3298fd4493
2 changed files with 16 additions and 0 deletions
@@ -49,6 +49,7 @@ fun String.nthIndexOf(
while (occur > 0) {
// calling the native function multiple times is faster than looping just once
pos = indexOf(ch, pos + 1)
if (pos == -1) return -1
occur--
}