On Thursday, 8 April 2021 at 12:19:29 UTC, WebFreak001 wrote:

```d
string to01String(int[] x) @safe
{
auto conv = x.to!(ubyte[]); // allocates new array, so later cast to string is OK conv[] += '0'; // assume all numbers are 0-9, then this gives the correct result
    return (() @trusted => cast(string)conv)();
}
```

The @trusted lambda can also be replaced with [std.exception.assumeUnique](https://dlang.org/library/std/exception/assume_unique.html).

Reply via email to