On Friday, 2 April 2021 at 05:01:27 UTC, rikki cattermole wrote:

On 02/04/2021 5:51 PM, mw wrote:
Then how can I construct `t`? to make this assertion true:

    assert(t == "head-abc-tail");  // failed!

Slice it.

string t = text("head-", s[0 .. 3], "-tail");

http://ddili.org/ders/d.en/slices.html

This is just an example, what if the exact length is not known statically, is there a functions to trim the `\0`s?


Reply via email to