>I am trying to check certain characters in a string in order to determine whether they are alpha or numeric characters. In FoxPro, I would convert the character to it's ascii value and check to see if the number returned was in the range of the alphabet characters or in the range of numbers 0-9. How would I accomplish that in C#?
>
>I thought I posted this question yesterday but can't seem to find it.
>Please forgive me if it's a rerun.
>
>Thanks.
>
>Linda
You can use Char structure's IsDigit,IsLetter, IsLetterOrDigit ... methods. ie:
bool isalpha = Char.IsLetter('c');
bool isdigit = Char.IsDigit("128 St.",2);
bool isspace = Char.IsWhiteSpace("128 St.",3);
bool ispunc = Char.IsPunctuation("128 St.",3);
bool isalphanum = Char.IsLetterOrDigit('\n'); // IsControl
Cetin