fromStringz

Returns new string formed from C-style (null-terminated) string msg. Usefull when interfacing with C libraries. For D-style to C-style convertion use std.string.toStringz.

string
fromStringz
pure nothrow
(
const char* msg
)

Parameters

msg
Type: char*

The C string to convert.

Examples

Example

char[] cstring = "some string".dup ~ cast(char)0;

assert(cstring.ptr.fromStringz == "some string");
assert(null.fromStringz == "");

Meta

Authors

NCrashed