How to loop through characters of a string in D language?

Luís Ferreira lsferreira at riseup.net
Fri Dec 10 12:47:11 UTC 2021


Yes it will. You can use lazy templates instead, like splitter and joiner, which splits and joins lazily, respectively. LDC can optimize those templates fairly well and avoid too much lazy calls and pretty much constructs the logic equivalent to for loop.

On 10 December 2021 11:06:21 WET, IGotD- via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
>On Friday, 10 December 2021 at 06:24:27 UTC, Rumbu wrote:
>
>> 
>> Since it seems there is a contest here:
>> 
>> ```d
>> "abc;def;ghi".split(';').join();
>> ```
>> 
>> :)
>
>Would that become two for loops or not?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20211210/32326361/attachment-0001.htm>


More information about the Digitalmars-d-learn mailing list