Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
October 07, 2011 contrary of std.utf.toUTFz!(const(wchar)*) | ||||
---|---|---|---|---|
| ||||
Hi all, I feel a little stupid, but how to convert a wchar* zero terminated string into a wstring (DMD 2.055)? I'm digging into Phobos, but right now I've found no way... Thanks, Paolo |
October 07, 2011 Re: contrary of std.utf.toUTFz!(const(wchar)*) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paolo Invernizzi | Paolo Invernizzi , dans le message (digitalmars.D.learn:29974), a
écrit :
> Hi all,
>
> I feel a little stupid, but how to convert a wchar* zero terminated string into a wstring (DMD 2.055)? I'm digging into Phobos, but right now I've found no way...
>
> Thanks, Paolo.
std.conv.to!wstring
|
October 07, 2011 Re: contrary of std.utf.toUTFz!(const(wchar)*) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paolo Invernizzi | > I feel a little stupid, but how to convert a wchar* zero terminated string into a wstring (DMD 2.055)?
wstring w = cstr[0 .. strlenw(cstr)];
|
October 07, 2011 Re: contrary of std.utf.toUTFz!(const(wchar)*) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | Trass3r , dans le message (digitalmars.D.learn:29978), a écrit :
>> I feel a little stupid, but how to convert a wchar* zero terminated string into a wstring (DMD 2.055)?
>
> wstring w = cstr[0 .. strlenw(cstr)];
if cstr comes from c code, you cannot guarantee it is immutable.
Moreover, cstr might point to 0.
|
October 07, 2011 Re: contrary of std.utf.toUTFz!(const(wchar)*) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christophe | Just wanted to point out how it's implemented with language tools. |
Copyright © 1999-2021 by the D Language Foundation