Casting between char[]/wchar[]/dchar[]
Derek Parnell
derek at psyc.ward
Sat Aug 5 14:58:10 PDT 2006
On Sat, 5 Aug 2006 17:23:08 -0400, Jarrett Billingsley wrote:
> import utf = std.utf;
>
> wchar[] utf16(char[] s)
> {
> return utf.toUTF16(s);
> }
>
> ...
>
> char[] s = "hello";
> wchar[] t = s.utf16;
>
> ;)
>
> Aren't first-array-param-as-a-property functions cool?
I don't want to rain on anyone's parade, but the new import formats kill
off this undocumented feature.
This works ...
import std.utf;
void main()
{
wchar[] w;
dchar[] d;
d = w.toUTF32();
}
This doesn't ....
static import std.utf;
void main()
{
wchar[] w;
dchar[] d;
d = w.std.utf.toUTF32();
}
And neither does this ...
import utf = std.utf;
void main()
{
wchar[] w;
dchar[] d;
d = w.utf.toUTF32();
}
--
Derek Parnell
Melbourne, Australia
"Down with mediocrity!"
More information about the Digitalmars-d
mailing list