M
Mats-Lennart Hansson
Hi,
I want to get the ANSI value (0-255) of a character. Assume I create a
character like this:
string s = new string((char) 151, 1);
Now I want to get the ANSI value (151) for this character. How do I do this?
When using ASCII I, of course get the wrong value:
byte[] arr = Encoding.ASCII.GetBytes(s); --> [63]
When using Unicode, I get two bytes where the first one is 151
byte[] arr = Encoding.Unicode.GetBytes(s); --> [151, 0]
Any help is appreciated!
Thanks,
Mats-Lennart
I want to get the ANSI value (0-255) of a character. Assume I create a
character like this:
string s = new string((char) 151, 1);
Now I want to get the ANSI value (151) for this character. How do I do this?
When using ASCII I, of course get the wrong value:
byte[] arr = Encoding.ASCII.GetBytes(s); --> [63]
When using Unicode, I get two bytes where the first one is 151
byte[] arr = Encoding.Unicode.GetBytes(s); --> [151, 0]
Any help is appreciated!
Thanks,
Mats-Lennart