mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 23:46:00 -06:00
#1776 CSV data parser. Remove double spaces in column names
This commit is contained in:
parent
660b6a6430
commit
8f5c3436ce
@ -39,3 +39,20 @@ bool RiaTextStringTools::compare(const QString& expected, const QString& actual)
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaTextStringTools::trimAndRemoveDoubleSpaces(const QString& s)
|
||||
{
|
||||
int length;
|
||||
QString trimmed = s.trimmed();
|
||||
|
||||
do
|
||||
{
|
||||
length = trimmed.size();
|
||||
trimmed = trimmed.replace(" ", " ");
|
||||
} while (trimmed.size() < length);
|
||||
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
|
@ -25,5 +25,6 @@ class QString;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
namespace RiaTextStringTools
|
||||
{
|
||||
bool compare(const QString& expected, const QString& actual);
|
||||
bool compare(const QString& expected, const QString& actual);
|
||||
QString trimAndRemoveDoubleSpaces(const QString& s);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "RiaDateStringParser.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "../Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h"
|
||||
@ -194,7 +195,7 @@ bool RifCsvUserDataParser::parseColumnInfo(QTextStream* dataStream, const AsciiD
|
||||
|
||||
for (int iCol = 0; iCol < colCount; iCol++)
|
||||
{
|
||||
QString colName = lineColumns[iCol];
|
||||
QString colName = RiaTextStringTools::trimAndRemoveDoubleSpaces(lineColumns[iCol]);
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::importedAddress(colName.toStdString());
|
||||
Column col = Column::createColumnInfoFromCsvData(addr, "");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user