How to iterate over range two items at a time

Adnan relay.public.adnan at outlook.com
Mon Feb 17 09:41:35 UTC 2020


On Monday, 17 February 2020 at 07:50:02 UTC, Mitacha wrote:
> On Monday, 17 February 2020 at 05:04:02 UTC, Adnan wrote:
>> What is the equivalent of Rust's chunks_exact()[1] method in 
>> D? I want to iterate over a spitted string two chunks at a 
>> time.
>>
>>
>> [1] 
>> https://doc.rust-lang.org/beta/std/primitive.slice.html#method.chunks_exact
>
> It sounds similar to `slide` 
> https://dlang.org/phobos/std_range.html#slide

The key difference here is that slide seems to overlap, which is 
a big no-no for my current problem.

I have just gone with a classic for loop. Error prone, but just 
works.


More information about the Digitalmars-d-learn mailing list