14-Dec-2013 21:20, bearophile пишет:
Marco Leise:

Not at all, the documentation explicitly states:

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

I didn't see the ' ' in the OP code, sorry.

A test:


void main() {
     import std.stdio, std.string, std.algorithm;
     auto s = "hello  world";
     s.split().writeln;
     std.array.splitter(s).writeln;
     s.splitter(' ').writeln;
}


The output seems OK:

Yup, there are 2 splitters - one that uses explicit separator and one that uses predicate. AFAIK the default predicate is std.uni.isWhite.

["hello", "world"]
["hello", "world"]
["hello", "", "world"]

Bye,
bearophile


--
Dmitry Olshansky

Reply via email to