Or you could use std::string.find_first_not_of() to check that the entire string doesn't contain any letters, or whatever else is invalid.

Also note: Most people consider the "command line" to be...