bySeparated

Returns an input range consisting of each separated word in the input argument

bySeparated
(
Range
Separators
bool strip = true
)
(
auto ref Range range
,
Separators sep
)
if (
isInputRange!Range &&
isSomeChar!(ElementType!Range)
)

Examples

1 auto text = "name = Douglas \n age =27 \n";
2 auto range = text.bySeparated(CharMap['=', '\n']);
3 assert(range.front == "name");
4 range.popFront;
5 assert(range.front == "Douglas");
6 range.popFront;
7 assert(range.front == "age");
8 range.popFront;
9 assert(range.front == "27");
10 range.popFront;
11 assert(range.empty);

Meta