string concatenation

dnewbie run3 at myopera.com
Sat Apr 7 22:08:09 PDT 2012


I have a wchar[] and I want to convert it to UTF8
then append a string. This is my code.

import std.c.windows.windows;
import std.string;
import std.utf;

int main()
{
   wchar[100] v;
   v[0] = 'H';
   v[1] = 'e';
   v[2] = 'l';
   v[3] = 'l';
   v[4] = 'o';
   v[5] = 0;
   string s = toUTF8(v) ~ ", world!";
   MessageBoxA(null, s.toStringz, "myapp", MB_OK);
   return 0;
}

I want "Hello, world!", but the result is "Hello" only. Please help me.


More information about the Digitalmars-d-learn mailing list