Dan Colbert <dc******@jdaehealth.com> wrote:
Simple but potentially dumb question:
How can I get the ASCII numeric value for a character in C#? In FoxPro, the
function ASC("A") returns a 65 (int). Is there a similar function in C#?
Just cast the character to an int, and it will give you the Unicode
value. (You don't actually need the cast unless you're distinguishing
between overloads.) The Unicode value of any ASCII character is the
same as its ASCII value.
For instance:
int i = 'a'; // i is now 65.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too