Variant of chunkBy that can lazily split a string on case-changes
Per Nordlöw
per.nordlow at gmail.com
Sat Oct 27 16:54:59 UTC 2018
Have anybody implemented a lazy iteration algorithm similar to
https://dlang.org/phobos/std_algorithm_iteration.html#chunkBy
that can group elements using a binary predicate being able to do
to the following.
This example
import std.ascii : isUpper, isLower;
foreach (e; ["SomeCamelCaseName"].chunkByX!((a,b) =>
a.isUpper && b.isLower))
{
writeln(e);
}
shall print
Some
Camel
Case
Name
?
More information about the Digitalmars-d-learn
mailing list