libs: make splitString also split last separator (#23851)

* libs: make splitString also split last separator

* libs: add tests for splitStrings
This commit is contained in:
Léo Gaspard
2017-03-15 22:16:04 +01:00
committed by zimbatm
parent e99bc64552
commit da6619cffe
2 changed files with 31 additions and 1 deletions

View File

@@ -291,7 +291,7 @@ rec {
recurse = index: startAt:
let cutUntil = i: [(substring startAt (i - startAt) s)]; in
if index < lastSearch then
if index <= lastSearch then
if startWithSep index then
let restartAt = index + sepLen; in
cutUntil index ++ recurse restartAt restartAt