From b60e4176a5bd6a31324d7d4057096f050a1d0b2e Mon Sep 17 00:00:00 2001 From: lauracosta Date: Mon, 20 May 2024 15:38:54 +0200 Subject: [PATCH] remove empty space from csv --- waterTable/importData.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/waterTable/importData.cpp b/waterTable/importData.cpp index 65a3d5f7..a70eb0cf 100644 --- a/waterTable/importData.cpp +++ b/waterTable/importData.cpp @@ -40,6 +40,7 @@ bool loadCsvRegistry(QString csvRegistry, std::vector &wellList, QString & wrongLines++; continue; } + items[posId] = items[posId].simplified(); QString id = items[posId].remove(QChar('"')); if (idList.contains(id)) { @@ -49,6 +50,7 @@ bool loadCsvRegistry(QString csvRegistry, std::vector &wellList, QString & continue; } idList.append(id); + items[posUtmx] = items[posUtmx].simplified(); double utmX = items[posUtmx].remove(QChar('"')).toDouble(&ok); if (!ok) { @@ -56,6 +58,7 @@ bool loadCsvRegistry(QString csvRegistry, std::vector &wellList, QString & wrongLines++; continue; } + items[posUtmy] = items[posUtmy].simplified(); double utmY = items[posUtmy].remove(QChar('"')).toDouble(&ok); if (!ok) { @@ -115,6 +118,7 @@ bool loadCsvDepths(QString csvDepths, std::vector &wellList, int waterTabl wrongLines++; continue; } + items[posId] = items[posId].simplified(); QString id = items[posId].remove(QChar('"')); bool found = false; int index = NODATA; @@ -134,7 +138,7 @@ bool loadCsvDepths(QString csvDepths, std::vector &wellList, int waterTabl wrongLines++; continue; } - + items[posDate] = items[posDate].simplified(); QDate date = QDate::fromString(items[posDate].remove(QChar('"')),"yyyy-MM-dd"); if (! date.isValid()) { @@ -142,7 +146,7 @@ bool loadCsvDepths(QString csvDepths, std::vector &wellList, int waterTabl wrongLines++; continue; } - + items[posDepth] = items[posDepth].simplified(); int value = items[posDepth].remove(QChar('"')).toInt(&ok); if (!ok || value == NODATA || value < 0 || value > waterTableMaximumDepth) {