Christopher Slowik [mailto:[EMAIL PROTECTED]] wrote:
> I'm using c# and need to compare each character in a string > to see if its an ascii dec 022. How do you declare an ascii > char in c#. Does c# have a chr function. I don't seem to be > able to find anything. TIA The System.Char datatype in the CLR is unicode. You can define your ascii character variable as a byte and assign initialize it like so: <codeSnippet language="C#"> byte asciiA = (byte)'A'; </codeSnippet> The value of asciiA will be 65. Also, you can also convert characters and strings to ASCII at runtime using System.Encoding.ASCII.GetBytes/GetString(). HTH, Drew [ .NET MVP | weblog: http://radio.weblogs.com/0104813/ ] You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.