one liner to split a string into every n chars?

Steven Schveighoffer schveiguy at gmail.com
Wed Apr 13 12:58:00 UTC 2022


On 4/13/22 2:26 AM, mw wrote:
> Hi,
> 
> What's the D's idiom to split a string into an array of every n chars? 
> (prefer one liner)

str.byChar.chunks(2).array;

Your request of "array of every n chars" is somewhat ambiguous. This is 
an array of chunks (not an array of arrays).

-Steve


More information about the Digitalmars-d-learn mailing list