#2031 Curve Calculator : Allow assignment without spaces around :=

This commit is contained in:
Magne Sjaastad
2017-10-23 13:11:38 +02:00
parent d903226db6
commit dd01863240
3 changed files with 42 additions and 8 deletions

View File

@@ -277,15 +277,17 @@ bool RimCalculation::calculate()
//--------------------------------------------------------------------------------------------------
QString RimCalculation::findLeftHandSide(const QString& expresion)
{
QString exprWithSpace = expresion;
exprWithSpace.replace("\n", " ");
QStringList words = exprWithSpace.split(" ", QString::SkipEmptyParts);
int index = words.lastIndexOf(":=");
int index = expresion.lastIndexOf(":=");
if (index > 0)
{
return words[index - 1];
QString s = expresion.left(index).simplified();
QStringList words = s.split(" ");
if (words.size() > 0)
{
return words.back();
}
}
return "";