www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - UTF escape

reply "Stephen Jones" <siwenjo gmail.com> writes:
Html has &#xxx to access fonts at xxx, does D have something 
similar?

writeln("a");

to

writeln(&#097);

Thanks.
Mar 13 2013
next sibling parent "Andrej Mitrovic" <andrej.mitrovich gmail.com> writes:
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)); }
Mar 13 2013
prev sibling next sibling parent "Brad Anderson" <eco gnuk.net> writes:
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");
Mar 13 2013
prev sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
And there's actually some named entities like

writeln("\&copy; 2014");

works in D.
Mar 13 2013