diff options
Autocommit at 28.05.2022 @ 18:29
1 files changed, 8 insertions, 6 deletions
| -rw-r--r-- | src/Models/Table.cpp | 14 |
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index bcaffb7..5d0c87f 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -19,12 +19,14 @@ bool containsNumber(const char*& str) { } void Table::putCell(unsigned row, unsigned col, const char* rawValue) { - unsigned intParse = atoi(rawValue); - unsigned doubleParse = atof(rawValue); Cell* newCell; - if (doubleParse - intParse > 0.00001 && doublePrase > 0.00001) - newCell = new CellDouble(doubleParse); - else if (intParse ) - newCell = + if (containsNumber(rawValue)) { + unsigned intParse = atoi(rawValue); + unsigned doubleParse = atof(rawValue); + + newCell = (doubleParse - intParse > 0.00001 && doubleParse > 0.00001) + ? new CellDouble(doubleParse) : new CellInt(intParse); + } + } |
