Skip to content

Commit

Permalink
strsliceutils: yield the right side of a final delim too
Browse files Browse the repository at this point in the history
  • Loading branch information
alaviss committed Sep 18, 2023
1 parent fe0beed commit 9e946b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sys/private/strsliceutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ iterator splitSlices*(s: string, chars: set[char]): Slice[int] =
yield start ..< idx
start = idx + 1

# Yield the rest if its longer than 0
# Yield the rest if its longer than 0 or if it ends in a delimiter
let remainder = start ..< s.len
if remainder.len > 0:
if remainder.len > 0 or (start > 0 and s[start - 1] in chars):
yield remainder

func add*(s: var string, buf: openArray[char]) =
Expand Down

0 comments on commit 9e946b1

Please sign in to comment.