| # | Line 217 | Line 217 | namespace oopse { | |
|---|---|---|
| 217 | return str.substr(0, str.find('.')); | |
| 218 | } | |
| 219 | ||
| 220 | + | bool isInteger(const std::string& str) { |
| 221 | + | |
| 222 | + | bool result = false; |
| 223 | + | |
| 224 | + | std::string::const_iterator i = str.begin(); |
| 225 | + | if (i != str.end() && (*i == '+' || *i == '-' || std::isdigit(*i) )) { |
| 226 | + | ++i; |
| 227 | + | while (i != str.end() && std::isdigit(*i)) |
| 228 | + | ++i; |
| 229 | + | if (i == str.end()) |
| 230 | + | result = true; |
| 231 | + | } |
| 232 | + | |
| 233 | + | return result; |
| 234 | } | |
| 235 | + | |
| 236 | + | } |
| – | Removed lines |
| + | Added lines |
| < | Changed lines |
| > | Changed lines |