asDString

Converts a zero-terminated C string to a D slice. Takes linear time and allocates no memory.

nothrow pure @nogc nothrow
asDString
(
C
)
()

Parameters

stringz C*

the C string to be converted

Return Value

Type: auto

a slice comprehending the string. The terminating 0 is not part of the slice.

Examples

const char* p = "123".ptr;
assert(p.asDString == "123");

Meta