is a char a number?

  • Thread starter Thread starter Wayne
  • Start date Start date
W

Wayne

In delphi I could do (if charvar in '0'..'9') and if charvar was a character
of 0 through 9 it would return true. Is there a simple way to do this? I
don't want to use a switch as I have to compare more than one char of a
string.

Or a regular expression with would work too, I need to verify that the file
extension is ##m. Will always be 2 numbers followed by an M. if you do give
me a reg ex, please also help out by telling me hot to use it. I've not had
to use them in C# yet.

--
Thanks
Wayne Sepega
Jacksonville, Fl

Enterprise Library Configuration Console Module Generator
http://workspaces.gotdotnet.com/elccmg

"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
Hi Wayne,

if(Char.IsDigit(myChar))

Also take a look at Char.IsLetter, and Char.IsLetterOrDigit
 
Back
Top