Open
Description
Description
unicode.splitWhitespace()
returns empty strings, but strutils.splitWhitespace()
not.
Test program:
import std / strutils
import std / unicode
let s = " foo \t bar baz "
echo strutils.splitWhitespace(s)
echo unicode.splitWhitespace(s)
Nim Version
Nim Compiler Version 2.0.4 [Linux: amd64]
Compiled at 2024-03-28
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: b47747d
active boot switches: -d:release
Current Output
@["foo", "bar", "baz"]
@["", "", "foo", "", "", "bar", "", "baz", "", ""]
Expected Output
Two times the same output.
Possible Solution
To me it looks like unicode.splitWhitespace()
should be adapted to the behaviour of strutils.splitWhitespace()
, because the behavior of strutils.splitWhitespace()
is documented (https://github.com/nim-lang/Nim/blob/version-2-0/lib/pure/strutils.nim#L698).
Additional Information
No response