[Issue 10772] std.regex.splitter generates spurious empty elements with empty delimiter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 19 10:22:47 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=10772
--- Comment #6 from monarchdodra at gmail.com 2013-12-19 10:22:46 PST ---
(In reply to comment #5)
> Arguably, 0-width splitting makes no sense: If it were to rigorously follow the
> rules, then you'd simply end up with an infinite amount of leading tokens.
> ["", "T", "E", "S", "T", ""]
> Makes no sense to me. Why is there an empty leading/trailing token, but none
> between each letter?
>
> This means that in regards to 0-length splitting, it should either be an
> *error*, or have a *special behavior*
>
> std.algorithm.split simply special cases to do what seems most useful (what is
> documented by pearl, AFAIK). I think having regex do the same is most sensible.
Hum... Actually, now that I think about it, algorithm splitter works on
constant length separator. I'm not sure how you'd handle a separator that may
and or may not be empty...
See the examples in your pull.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list