forked from markus/S_New4
fix error: 0 is No number
This commit is contained in:
parent
34c1fc637f
commit
c021a655dd
@ -939,12 +939,16 @@ bool nothingExists(std::string path)
|
||||
|
||||
bool isNumber(std::string number)
|
||||
{
|
||||
for (size_t i = 0; i < number.length(); ++i) {
|
||||
bool hasRemovedZero = false;
|
||||
for (size_t i = 0; i < number.length(); ++i)
|
||||
if( number[i] == '0') {
|
||||
number.erase(i, 1);
|
||||
i--;
|
||||
hasRemovedZero=true;
|
||||
}
|
||||
}
|
||||
if(hasRemovedZero && number == "")
|
||||
number="0";
|
||||
|
||||
return (std::to_string(atoll(number.c_str())) == number) ? true : false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user