Unfold string array

Temtaime temtaime at gmail.com
Mon Jan 6 00:03:06 UTC 2020


On Sunday, 5 January 2020 at 22:39:37 UTC, Teo wrote:
> On Sunday, 5 January 2020 at 13:37:58 UTC, JN wrote:
>> [...]
>
> Thanks for the input.
> I just realized that I was not precise enough in my 
> description. Apologies for that.
> My intention is to use std.algorithm, if possible.
>
> I read the documentation and tried using many functions like 
> "joiner", "each", "fold", "group", "filter", etc. from 
> std.algorithm.iteration.
>
> In my opinion, I need to construct a predicate like
> (a, b) => if b.startsWith(<white space>) {join(a, b, " ")}
> Unfortunately, I cannot figure out which combination of 
> functions will give me the desired result.
>
> Of course, if I am unable to find an elegant way to do it, I am 
> going to iterate over the array in a way similar to what you 
> suggested.

https://ideone.com/tvpreP


More information about the Digitalmars-d-learn mailing list