toUTF16z

toUTF16z is a convenience function for toUTFz!(const(wchar)*).

Encodes string s into UTF-16 and returns the encoded string. toUTF16z is suitable for calling the 'W' functions in the Win32 API that take an LPCWSTR argument.

@safe pure
const(wchar)*
toUTF16z
(
C
)
(
const(C)[] str
)

Examples

string str = "Hello, World!";
const(wchar)* p = str.toUTF16z;
assert(p[str.length] == '\0');

Meta