String.toStringz

Returns null-terminated string. The returned string is managed by this object and shouldn't be freed.

struct String
@nogc nothrow pure @system
const(char)*
toStringz
()

Return Value

Type: const(char)*

Null-terminated string.

Examples

auto s = String("C string.");
assert(s.toStringz()[0] == 'C');
assert(s.toStringz()[9] == '\0');

Meta