remove_empty removes non-empty delimiters
Closed this issue · 1 comments
chocolateboy commented
StringSplitter | 1.1.1 |
---|---|
Ruby | ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux] |
OS | Linux (Arch) |
The remove_empty
option removes empty fields, as expected, but it also appears to be removing non-empty delimiters.
Test
ss = StringSplitter.new(remove_empty: true, include_captures: true)
ss.split("::", ":")
Expected
[":", ":"]
Actual
[]
chocolateboy commented
Forgot to capture the delimiter:
ss = StringSplitter.new(remove_empty: true, include_captures: true)
ss.split("::", /(:)/)
# => [":", ":"] ✔