diff options
Diffstat (limited to 'lib/String.cc')
-rw-r--r-- | lib/String.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/String.cc b/lib/String.cc index 60ca6df..d131fba 100644 --- a/lib/String.cc +++ b/lib/String.cc @@ -314,7 +314,7 @@ double String::datedif(const String & s) const { } bool String::is_number(void) const { - for (size_t i = ((str[i] == '-') ? 1 : 0); i < siz; i++) { + for (size_t i = ((str[0] == '-') ? 1 : 0); i < siz; i++) { if ((str[i] > '9') || (str[i] < '0')) return false; } return true; @@ -323,7 +323,7 @@ bool String::is_number(void) const { bool String::is_float(void) const { bool seendot = false; - for (size_t i = ((str[i] == '-') ? 1 : 0); i < siz; i++) { + for (size_t i = ((str[0] == '-') ? 1 : 0); i < siz; i++) { if ((str[i] > '9') || (str[i] < '0')) { if ((str[i] == '.') && !seendot) { seendot = true; |