Bug 5054 – Splitter example doesn't work

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-10-14T10:25:00Z
Last change time
2010-11-16T12:58:46Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2010-10-14T10:25:40Z
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 by bearophile_hugs — 2010-10-14T10:58:55Z
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 by andrej.mitrovich — 2010-10-14T11:14:55Z
*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 by rsinfu — 2010-11-16T12:58:46Z