On Monday, 11 January 2021 at 15:45:51 UTC, Marcone wrote:

I can reffer length of literal string using $.

"Hello World"[0..$]

But I want make like it witout use variable name.

"Hello World"[0..?.indexOf("o")]

The exact syntax you want is impossible. The closest you can get is to use an `enum` constant, which is essentially a named literal:

enum hello = "Hello World";
writeln(hello[0 .. hello.countUntil("o")]); // "Hell"

Reply via email to