PDA

View Full Version : QString help



mabeeh
13th May 2008, 20:32
I want to concatenate two strings together and have the text appear as one line. Not sure when this doesn't work. Please help. Thanks!

Code Example:

if (strCommands.at(i).startsWith("step number:",Qt::CaseInsensitive))
{
stepNumberText = strCommands.at(i).trimmed();
}
else
{
actionText = strCommands.at(i).trimmed();
uaTotal++;
}

lineText = stepNumberText.simplified() + " -- " + actionText.simplified()
std::cout << lineText.toStdString() << std::endl;

Output:

step number: 2 --
-- User Action: "Do Something"
step number: 3 --
-- User Verify: "Do Something else"
step number: 4 --
-- User Action: "Do this"
-- User Action: "do it again"

wysota
13th May 2008, 21:50
Try this:


#include <QtDebug>
qDebug() << stepNumberText.simplified() << actionText.simplified();
And see if the output is in a single line. If it's not, you have some newlines somewhere.