std.array string.split("") bug

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Aug 7 13:15:03 PDT 2013


On Wed, Aug 07, 2013 at 12:44:54PM -0700, H. S. Teoh wrote:
> On Wed, Aug 07, 2013 at 09:10:04PM +0200, Borislav Kosharov wrote:
> > Something strange happens when I do this:
> > 
> > unittest {
> >     import std.array, std.string;
> >     string s = "test";
> >     //assert(s.toUpper.split("").join("-") == "T-E-S-T");
> >     //"Memory allocation failed"
> >     //[Finished in 26.5s]
> >     //CPU: 1% -> 50% | 2.7GHz dual core
> >     //RAM: 1.6GB -> 2.6GB | 1GB diff
> >     assert(s.split("") == ["t","e","s","t"]);
> >     //ditto
> > }
> > 
> > I just want to achieve what the commented assert's result should be.
> > Is there a better way to do that? And if it is really a bug where
> > should I report it?
> 
> Looks like a bug with split(); it doesn't terminate when the delimiter
> is an empty string.
> 
> Please report a bug here: http://d.puremagic.com/issues/
[...]

Actually, don't worry about that, I've just filed the bug myself:

	http://d.puremagic.com/issues/show_bug.cgi?id=10773


T

-- 
All problems are easy in retrospect.


More information about the Digitalmars-d mailing list