what exactly is string length?

rikki cattermole rikki at cattermole.co.nz
Fri Apr 2 05:01:27 UTC 2021


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


More information about the Digitalmars-d-learn mailing list