Playing card suits, vb.net?

  • Thread starter Thread starter eejit
  • Start date Start date
E

eejit

Another newbie question. I'm writing a program that reviews a text
file history of an online poker hand.

I'm using VB compact framework, for a pocket pc.

I'm trying to find a simple way to represent the suits of cards,
clubs, diamonds, spades, hearts, in a string. I thought for sure there
would be some sort of ASCII symbol that I could just use in a string,
but I haven't found anything.

Is there a simple way to do this that I am missing?

Thanks for any help.

eejit
 
eejit said:
Another newbie question. I'm writing a program that reviews a text
file history of an online poker hand.

I'm using VB compact framework, for a pocket pc.

I'm trying to find a simple way to represent the suits of cards,
clubs, diamonds, spades, hearts, in a string. I thought for sure there
would be some sort of ASCII symbol that I could just use in a string,
but I haven't found anything.

Is there a simple way to do this that I am missing?

Thanks for any help.

eejit

The suits are in the Arial font. Open up charmap (start->run->charmap)
and you'll see them if you scroll down (U+2660 it tells me in the status
line of charmap).
 
I'm trying to find a simple way to represent the suits of cards,
Public Const chSpade As Char = ChrW(9824)
Public Const chHeart As Char = ChrW(9829)
Public Const chDiamond As Char = ChrW(9830)
Public Const chClub As Char = ChrW(9827)

Use these just like any other string, eg "A" & chSpade gives "Aâ™ ". These
are the correct values, but not all fonts cooperate.

This is unicode, not ascii, where a character in a string is 16 bits (not
8). Unicode is the default for basic, so you don't have to do anything
special to call ChrW() with big numbers.

If you need to print, your printer may not be capable of representing these
characters, so you may need a fallback, maybe s,h,d,c. '8s 8c As Jd 2h'
doesn't look too bad.
 
Public Const chSpade As Char = ChrW(9824)
Public Const chHeart As Char = ChrW(9829)
Public Const chDiamond As Char = ChrW(9830)
Public Const chClub As Char = ChrW(9827)

Use these just like any other string, eg "A" & chSpade gives "A?". These
are the correct values, but not all fonts cooperate.

This is unicode, not ascii, where a character in a string is 16 bits (not
8). Unicode is the default for basic, so you don't have to do anything
special to call ChrW() with big numbers.

If you need to print, your printer may not be capable of representing these
characters, so you may need a fallback, maybe s,h,d,c. '8s 8c As Jd 2h'
doesn't look too bad.


Thanks to everyone for taking the time to reply.

I decided to go with the arial font chrw(9824) method. I tested it out
in vb and it works, but for some reason when I try it using the
compact framework, arial font, instead of the playing card suit, I get
a square. So I'm not quite sure what is going on here.

thanks again for the help.

eejit
 
Back
Top