what's the right way to get char* from string?
aki via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu May 5 08:22:35 PDT 2016
On Thursday, 5 May 2016 at 11:35:09 UTC, Jonathan M Davis wrote:
> If you want a different mutability, then use the more general
> function std.utf.toUTFz. e.g. from the documentation:
>
> auto p1 = toUTFz!(char*)("hello world");
> auto p2 = toUTFz!(const(char)*)("hello world");
> auto p3 = toUTFz!(immutable(char)*)("hello world");
> auto p4 = toUTFz!(char*)("hello world"d);
> auto p5 = toUTFz!(const(wchar)*)("hello world");
> auto p6 = toUTFz!(immutable(dchar)*)("hello world"w);
>
> - Jonathan M Davis
Ah! This can be a solution.
Thanks Jonathan.
-- aki.
More information about the Digitalmars-d-learn
mailing list