|
|
| 57 |
//---------------------------------------------- |
57 |
//---------------------------------------------- |
| 58 |
|
58 |
|
| 59 |
inline bool isNumeric(const std::string& s) { |
59 |
inline bool isNumeric(const std::string& s) { |
| 60 |
char *endp; |
60 |
bool decimalPtSeen = false; |
| 61 |
double unused = strtod(s.c_str(), &endp); // declared with warn_unused_result |
61 |
|
| 62 |
unused = unused; // quiet compiler |
62 |
for (std::string::const_iterator it = s.begin (); it != s.end (); it++) |
| 63 |
return endp == s.c_str() + s.size(); |
63 |
{ |
|
|
64 |
if (((*it == '.') && (decimalPtSeen)) || (0 == isdigit (*it))) |
| 65 |
return false; |
| 66 |
else if (*it == '.') |
| 67 |
decimalPtSeen = true; |
| 68 |
} |
| 69 |
return true; |
| 64 |
} |
70 |
} |
| 65 |
|
71 |
|
| 66 |
void |
72 |
void |