digitalmars.D.learn - Variant of chunkBy that can lazily split a string on case-changes
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (17/17) Oct 27 2018 Have anybody implemented a lazy iteration algorithm similar to
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (6/8) Oct 27 2018 Oops, turns out I already had this at
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 ?
Oct 27 2018
On Saturday, 27 October 2018 at 16:54:59 UTC, Per Nordlöw wrote:that can group elements using a binary predicate being able to do to the following.Oops, turns out I already had this at https://github.com/nordlow/phobos-next/blob/721374f3815db41cc213b108f81ca13ea7b93721/src/slicing.d#L12 This is a less generic solution though with a unary predicate but it works in my case. Still looking for a more general solution.
Oct 27 2018