I'm trying to validate that the input a user gives my program via
is an integer.
does not work, as far as i can tell, because
gets a string from the user, so it will always return false even if the user enters an valid integer (in string form). One would think I could simply use
on the input and be done with it, but that raises another issue -
. So if I relied on
to solve my problems, anything starting with numbers will work.
How do I cleanly validate that the value is an integer only, and not a combination of numbers and letters? Or do I need to resort to regex for this?