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

Marcone marcone at email.com
Mon Jan 11 16:53:44 UTC 2021


On Monday, 11 January 2021 at 16:41:03 UTC, oddp wrote:
> 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

I want more support inside slice []


More information about the Digitalmars-d-learn mailing list