The first 127 characters of Unicode are in fact ASCII (might be the
first 255, I'm not sure, but the first 127 for sure). In other words,
it you do:
int i = (int)'A';
will result in i=65, the ASCII value for A. char is a numeric type
remember, so you don't really have to cast to int, I just did it that
way to better illustrate what was happening.
To go the other way, it's just:
int i = 65;
char c = (char)i;
That assumes i<127.
Frank
David Kerber wrote:
I know "Ascii value" isn't quite the correct term, but it's the only one
I could come up with.
What Im trying to come up with is the simplest way of coming up with the
numeric value associated with a given character, and to go back the
other direction as well. In VB, these are the ASC() and chr()
functions. I know how to get these values by going through a Byte type,
but is there a quicker way to get (for example):
Starting with "B", return 66, or starting with " " (one space), return 32?
Going the other way, 66 should return "B", and 32 should return " ".
Thanks for any suggestions!
DAve
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]