D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5054 - Splitter example doesn't work
Summary: Splitter example doesn't work
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-14 10:25 UTC by Andrej Mitrovic
Modified: 2010-11-16 12:58 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2010-10-14 10:25:40 UTC
DMD 2.048 (not tested with 2.049):

From http://www.digitalmars.com/d/2.0/phobos/std_algorithm.html#Splitter :

import std.algorithm

void main()
{
    assert(equal(splitter("hello  world", ' ') == ["hello", "", "world"]);
}

-- Some 5 lines of error messages..
Comment 1 bearophile_hugs 2010-10-14 10:58:55 UTC
Your code has some bugs, try this:


import std.algorithm;
void main() {
    assert(equal(splitter("hello  world", ' '), ["hello", "", "world"]));
}


Unless you have other problems, you may close this bug report as ivalid.
Comment 2 Andrej Mitrovic 2010-10-14 11:14:55 UTC
*I* was missing a closing bracket right there, sorry. But the documentation is the one having the "==" instead of ",".

Docs:

assert(equal(splitter("hello  world", ' ') == [ "hello", "", "world" ]));

Should be:

assert(equal(splitter("hello  world", ' '), [ "hello", "", "world" ]));

So that needs fixing. :)
Comment 3 Shin Fujishiro 2010-11-16 12:58:46 UTC
Fixed: http://www.dsource.org/projects/phobos/changeset/2168