Convert string to wchar.

Pelle pelle.mansson at gmail.com
Wed Aug 3 00:34:53 PDT 2011


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);
}


More information about the Digitalmars-d-learn mailing list