mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Начинаем отличать дату от числа
This commit is contained in:
@@ -157,12 +157,17 @@ boolean isDigitStr(const String& str) {
|
||||
}
|
||||
|
||||
boolean isDigitDotCommaStr(const String& str) {
|
||||
bool dotCountWas = false;
|
||||
for (size_t i = 0; i < str.length(); i++) {
|
||||
char latter = str.charAt(i);
|
||||
//если символ не цифра и не точка и не тире
|
||||
if (!isDigit(latter) && latter != '.' && latter != '-') {
|
||||
return false;
|
||||
}
|
||||
if (latter == '.') { // проверяем на две точки, чтоб исключить дату
|
||||
if (dotCountWas) return false;
|
||||
dotCountWas = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user