How can I directly reffer literal element itself inside [] slice?

oddp oddp at posteo.de
Mon Jan 11 16:41:03 UTC 2021


On 11.01.21 16:45, Marcone via Digitalmars-d-learn wrote:
> "Hello World"[0..?.indexOf("o")]

Does until [1] do the trick?

"Hello World".until("o") // => "Hell"

[1] https://dlang.org/library/std/algorithm/searching/until.html


More information about the Digitalmars-d-learn mailing list