What is the difference between isdigit() and isnumber()?

isnumber() may be an Apple-specific C++ method (I don’t have a Mac on hand to check). You can see it in the Apple dev guide:

The isnumber() function behaves similarly to isdigit(), but may recognize additional characters, depending on the current locale setting.


Besides, isnumber() is not declared on Linux: I use g++ 6.1.1 on Linux 4.7.2 and get the error:

g++ a.cpp
a.cpp: In function 'int main(int, char**)':
a.cpp:20:17: error: 'isnumber' was not declared in this scope
   if (isnumber(i)) {
                 ^

I also use clang3.8.1 to test:

clang++ a.cpp --std=c++11
a.cpp:20:7: error: use of undeclared identifier 'isnumber'
                if (isnumber(i)) {
                    ^

Leave a Comment