Thread overview
UTF escape
Mar 13, 2013
Stephen Jones
Mar 13, 2013
Andrej Mitrovic
Mar 13, 2013
Brad Anderson
Mar 13, 2013
Adam D. Ruppe
March 13, 2013
Html has &#xxx to access fonts at xxx, does D have something similar?

writeln("a");

to

writeln(&#097);

Thanks.
March 13, 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));
}
March 13, 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.

What Andrej said or you can use the unicode escapes (they are in hexadecimal):

writeln("\u0061");
March 13, 2013
And there's actually some named entities like

writeln("\© 2014");

works in D.