I'm trying to search for the beginning of a number. isdigit
is there a c++ function that can include negatives in isdigit
? So that it will match the first character of the number: "-13"?
No there isn't. A digit is one thing that comprises a representation of a number, along with the radix, sign, decimal separator, thousands separator, and perhaps other things such as exponentation.
If -
was emitted into isdigit
then you could expect some folk to want +
to be included too, and perhaps even (
and )
to keep the accountants happy.
So in summary, testing if something is a representation of a number is an entirely different beast to testing if a particular character is a digit.