#2225 Well formations: Handle tabs in well path formations reader

This commit is contained in:
Rebecca Cox 2017-12-05 16:27:21 +01:00
parent 8e3f02879c
commit bef764bf5b

View File

@ -23,6 +23,10 @@
#include <QFile>
#include <QStringList>
#include <algorithm>
#include <string>
#include <cctype>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -50,6 +54,14 @@ std::map<QString, cvf::ref<RigWellPathFormations>>
return result;
}
void removeWhiteSpaces(QString* word)
{
std::string wordStd = word->toStdString();
wordStd.erase(std::remove_if(wordStd.begin(), wordStd.end(), [](unsigned char x) {return std::isspace(x); }), wordStd.end());
(*word) = QString(wordStd.c_str());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -66,10 +78,10 @@ void RifWellPathFormationReader::readFileIntoMap(const QString&
while (header.size() < 3)
{
QString line = data.readLine().toLower();
QString lineWithoutSpaces = line.remove(' ');
QString line = data.readLine().toLower();
removeWhiteSpaces(&line);
header = lineWithoutSpaces.split(';', QString::KeepEmptyParts);
header = line.split(';', QString::KeepEmptyParts);
}
const QString wellNameText = "wellname";