Convert string to wchar.

Jacob Carlborg doob at me.com
Wed Aug 3 04:05:45 PDT 2011


On 2011-08-03 09:34, Pelle wrote:
> On Wed, 03 Aug 2011 08:29:09 +0200, Jacob Carlborg <doob at me.com> wrote:
>> Yes, convert the first code point to a wchar and then throw if there's
>> more the one character in the string.
>>
>
> Not tested, and I might be wrong, but 'to!' should work between dchar
> and wchar, no?
>
> wchar to_wchar(string s) {
> auto c = s.front;
> s.popFront();
> assert (s.empty);
> return to!wchar(c);
> }

Ok, thanks.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list