Wide characters support in D

Ali Çehreli acehreli at yahoo.com
Mon Jun 7 19:37:05 PDT 2010


Steven Schveighoffer wrote:
> a function that takes 
> a char[] can also take a dchar[] if it is sent through a converter (i.e. 
> toUtf8 on Tango I think).

In Phobos, there are text, wtext, and dtext in std.conv:

/**
    Convenience functions for converting any number and types of
    arguments into _text (the three character widths).

    Example:
    ----
    assert(text(42, ' ', 1.5, ": xyz") == "42 1.5: xyz");
    assert(wtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"w);
    assert(dtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"d);
    ----
*/

Ali


More information about the Digitalmars-d mailing list