Re: range simple toy problem

2018-06-01 Thread Xiaoxi via Digitalmars-d-learn
On Friday, 1 June 2018 at 18:40:45 UTC, ag0aep6g wrote: On 06/01/2018 07:00 PM, Xiaoxi wrote: This prints "3 4 5 6 7 8 9": import std.range; import std.algorithm; import std.stdio; void main() { auto s = "1 2 3 4 5 6 7 8 9"; auto iter = refRange(&s).splitter!(c => c == ' ').drop(2);

Re: range simple toy problem

2018-06-01 Thread ag0aep6g via Digitalmars-d-learn
On 06/01/2018 07:00 PM, Xiaoxi wrote: import std.range; import std.algorithm; import std.string; import std.stdio; void main() {   auto s = "1 2 3 4 5 6 7 8 9";   auto iter = s.split(" ").drop(2);   // How to find the unconsumed/not-split part of s here?   // i.e. "3 4 5 6 7 8 9" NOT ["3",

Re: range simple toy problem

2018-06-01 Thread Alex via Digitalmars-d-learn
On Friday, 1 June 2018 at 17:00:45 UTC, Xiaoxi wrote: import std.range; import std.algorithm; import std.string; import std.stdio; void main() { auto s = "1 2 3 4 5 6 7 8 9"; auto iter = s.split(" ").drop(2); // How to find the unconsumed/not-split part of s here? // i.e. "3 4 5

Re: range simple toy problem

2018-06-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/1/18 1:00 PM, Xiaoxi wrote: import std.range; import std.algorithm; import std.string; import std.stdio; void main() {   auto s = "1 2 3 4 5 6 7 8 9";   auto iter = s.split(" ").drop(2);   // How to find the unconsumed/not-split part of s here?   // i.e. "3 4 5 6 7 8 9" NOT ["3", "4",

range simple toy problem

2018-06-01 Thread Xiaoxi via Digitalmars-d-learn
import std.range; import std.algorithm; import std.string; import std.stdio; void main() { auto s = "1 2 3 4 5 6 7 8 9"; auto iter = s.split(" ").drop(2); // How to find the unconsumed/not-split part of s here? // i.e. "3 4 5 6 7 8 9" NOT ["3", "4", "5", "6", "7", "8", "9"]