UTF escape

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Mar 13 15:03:30 PDT 2013


On Wednesday, 13 March 2013 at 21:59:54 UTC, Stephen Jones wrote:
> Html has &#xxx to access fonts at xxx, does D have something 
> similar?
>
> writeln("a");
>
> to
>
> writeln(&#097);
>
> Thanks.

No but you can easily create this on your own:

import std.string;
import std.stdio;

string[dchar] transTable;
shared static this()
{
     transTable = ['a' : "&#097", 'b' : "&#098"];
}

void main()
{
     string input = "afoo bfoo";
     writeln(input.translate(transTable));
}


More information about the Digitalmars-d-learn mailing list