Wide characters support in D

Michel Fortin michel.fortin at michelf.com
Tue Jun 8 05:02:38 PDT 2010


On 2010-06-08 04:15:50 -0400, Ruslan Nikolaev <nruslan_devel at yahoo.com> said:

> No. From the very beginning I said "it would also be nice to have some 
> builtin function for conversion to dchar". That means it would be nice 
> to have function that converts from tchar (regardless of its width) to 
> UTF-32. The reason was always clear - you normally don't need UTF-32 
> chars/strings but for some character analysis you might need them.

Is this what you want?

	version (utf16)
		alias wchar tchar;
	else
		alias char tchar;

	alias immutable(tchar)[] tstring;

	import std.utf;

	unittest {
		tstring tstr = "hello";
		dstring dstr = toUTF32(tstr);
	}


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list