Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how many numbers in an int?

Status
Not open for further replies.

birney29

Programmer
Oct 11, 2001
140
GB
im trying to check an integer has no more than 2 digits. ie. "99"would be valid but "100" would be illegal. ow do i do this?
thanks
 
Hi Birney

This could be one Method of doing it.
1. First Validate the Number. If validation is success, then convert it to string and find the length.
If the length of the string is more than 2 then u can say invalid.

Shyam Shyam
 
Math.abs(integer)>=100

or am I overlooking something here?

Swamphen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top