On Tuesday, 24 June 2014 at 18:34:31 UTC, Chris Cain wrote:
You can do what he said, but you'll have to write your own strlen function:

something like:

    size_t strlen(in dchar* s) pure @system nothrow
    {
        size_t pos = 0;
        dchar term = '\0';
        while(s[pos] != term)
            ++pos;
        return pos;
    }
    const(dchar)* ds = "hello\0";
    dstring text = ds[0..strlen(ds)].idup;
    writeln(text);

works
It works indeed, thanks a lot! Any chance of making it into std phobos?

Reply via email to