How to add a character literal to a string without ~ operator?

Salih Dincer salihdb at hotmail.com
Fri Apr 5 02:39:56 UTC 2024


On Thursday, 4 April 2024 at 19:56:50 UTC, Ferhat Kurtulmuş wrote:
> My favorite d feature is lazy ranges. No allocation here.
>
> ```d
> auto s = chain("as ", "df ", "j"); // s is lazy
> writeln(s);
> ```

```d
import std.range : chain;
void main()
{
   string word = "hello";
   auto noError = chain(word, "f", " ", "World");
   /** auto noCompile = chain('f', " ", "World");
     *                         ^
      *************************|****************/
}
```

SDB at 79


More information about the Digitalmars-d-learn mailing list