Instead of "filtering out", try "filtering in". There are many characters that you do not account for, and would be silly to try. A simpler approach would be to look at character for character to determine if each character is a 0 through a 9 - as apposed to searching for everything else.
Another even simpler approach would be to use regex. ie: boost::regex
Another even simpler approach would be to use regex. ie: boost::regex
- Billism