Test for integer

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

I have a 3 character string that I want to test to see if it is a positive
integer... I could test that each individual character is >=0 and <=9... is
there a better way ?

Is there an IsInteger() function ?
 
Rob said:
I have a 3 character string that I want to test to see if it is a positive
integer... I could test that each individual character is >=0 and <=9... is
there a better way ?


If you are using .NET 2.0, you may want to use 'Integer.TryParse'. In .NET
1.0/1.1 you can use 'Integer.Parse' + exception handling. Maybe using
'IsNumeric' is an option too.
 
Herfried K. Wagner said:
If you are using .NET 2.0, you may want to use 'Integer.TryParse'. In
.NET 1.0/1.1 you can use 'Integer.Parse' + exception handling. Maybe
using 'IsNumeric' is an option too.

Hmm, I have wondered for a long while why they didn't make a TryParse for
Integer...they did for Double...

<shrug>

:)

Mythran
 

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

Back
Top