• Post Reply Bookmark Topic Watch Topic
  • New Topic

ASCII/Unicode Card reprsentation  RSS feed

 
James Chegwidden
Author
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to print out the ASCII/unicode representation of hearts, clubs, spades and diamonds

instead of saying with strings...
String suits[] = { "Hearts", "Diamonds", "Clubs", "Spades" };
I tried this

String suits[] = { "\u2665", "\u2666", "\u2663", "\u2660" };

when printing I got a ?

http://www.fileformat.info/info/unicode/char/2660/index.htm

I noticed this...string.toUpperCase()
my unicode is rusty...
 
James Chegwidden
Author
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind I got it...wrong Unicode values
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by James Chegwidden:
Nevermind I got it...wrong Unicode values

What did you use instead?

The key is finding an application that knows how to interpret these values and display the desired symbol. Consoles (even Mac's Terminal) are generally not good at this. Note, however, that putting your original values into a Swing application should work nicely...
 
James Chegwidden
Author
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did you use instead?


Actually I went back to a swing based unicode and the first set worked. Thanks...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!