cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
How to check a string for digits
How to check a string for digits
Oct 5, 2012 at 3:46am UTC
Nick3306
(1)
I need to check a string and make sure it only has digits. I know how to check certain positions inside the string with (isdigit(str[0])) but is there a way to check the whole thing at once?
Oct 5, 2012 at 4:03am UTC
Aramil of Elixia
(772)
isdigit(str.c_str())?
Oct 5, 2012 at 4:10am UTC
maeriden
(872)
isdigit() takes a char as argument, not a char*
I don't think that's possible
Oct 5, 2012 at 4:44am UTC
Aramil of Elixia
(772)
oh well i tried.
Topic archived. No new replies allowed.