splitWithPrefixAndSuffix

Include delimiters in result chunks as prefix/suffix

S[]
splitWithPrefixAndSuffix
(
S
)

Examples

	auto s = q"EOF
Section 1:
10
11
12
Section 2:
21
22
23
Section 3:
31
32
33
EOF";
	auto parts = s.splitWithPrefixAndSuffix("Section ", "\n");
	assert(parts.length == 3 && parts.join == s);
	foreach (part; parts)
		assert(part.startsWith("Section ") && part.endsWith("\n"));

Meta