Re: Unicode arithmetic at run-time

2014-09-24 Thread kiran kumari via Digitalmars-d-learn
On Sunday, 21 September 2014 at 03:00:34 UTC, Charles McAnany wrote: Friends, I note that there are playing cards in unicode: http://en.wikipedia.org/wiki/Playing_cards_in_Unicode They follow a nice pattern, so I can quickly convert from a rank and suit to the appropriate escape sequence in D.

Re: Unicode arithmetic at run-time

2014-09-21 Thread ketmar via Digitalmars-d-learn
On Mon, 22 Sep 2014 01:02:32 + Vladimir Panteleev via Digitalmars-d-learn wrote: > A bit less ugly: > writefln("%c", dchar('\U0001F0A1'+1)); this won't work in gdc, though: 2.066 it not landed yet. signature.asc Description: PGP signature

Re: Unicode arithmetic at run-time

2014-09-21 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 21 September 2014 at 03:13:19 UTC, Adam D. Ruppe wrote: writefln("%c", cast(dchar)('\U0001F0A1'+1)); A bit less ugly: writefln("%c", dchar('\U0001F0A1'+1));

Re: Unicode arithmetic at run-time

2014-09-20 Thread ketmar via Digitalmars-d-learn
On Sat, 20 Sep 2014 22:12:52 -0700 Ali Çehreli via Digitalmars-d-learn wrote: > My unimportant contribution to this thread: It is actually uint in > this case. :) ah, sure. i just lost that 'u' somewhere... gotta find it. ;-) signature.asc Description: PGP signature

Re: Unicode arithmetic at run-time

2014-09-20 Thread Ali Çehreli via Digitalmars-d-learn
On 09/20/2014 08:14 PM, ketmar via Digitalmars-d-learn wrote: > arichmetics with dchars automatically coerces to int My unimportant contribution to this thread: It is actually uint in this case. :) Ali

Re: Unicode arithmetic at run-time

2014-09-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 21 September 2014 at 03:00:34 UTC, Charles McAnany wrote: writefln("%c", '/U0001F0A1'+1); // The problem here is just that arithmetic converts everything back to integers and writefln is a bit picky about types. You can print it though by casting it back to dchar: writefl

Re: Unicode arithmetic at run-time

2014-09-20 Thread ketmar via Digitalmars-d-learn
On Sun, 21 Sep 2014 03:00:32 + Charles McAnany via Digitalmars-d-learn wrote: can't this help: writefln("%c", cast(dchar)('\U0001F0A1'+1)); arichmetics with dchars automatically coerces to int, so you must cast result back to dchar. signature.asc Description: PGP signature