is a char a number?

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
 
M

Morten Wennevik

Hi Wayne,

if(Char.IsDigit(myChar))

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top