Hello,
I'm trying to find a string inside a QStringList which is in a loop, but it doesn't seem to be working. I'm not sure whether I'm doing it right or not.
I tried debugging it for hours with no luck. It might be the way I'm parsing the data coming from the QTcpSocket ?
Am i doing it wrong?
The code is below:
void Core::connected()
do
{
data = in.readLine();
if ( words.count() > 2 )
{
// at this point, words should be something like = ("nmuntz@localhost", "MSG", ":VERSION");
if ( words.contains(":VERSION", Qt::CaseInsensitive) )
qDebug() << "words contains the word version!!!";
}
while ( !in.atEnd() ) ;
}
}
void Core::connected()
QTextStream in(tcpSocket);
QString data;
do
{
data = in.readLine();
QStringList words = data.split(" ");
if ( words.count() > 2 )
{
// at this point, words should be something like = ("nmuntz@localhost", "MSG", ":VERSION");
if ( words.contains(":VERSION", Qt::CaseInsensitive) )
qDebug() << "words contains the word version!!!";
}
while ( !in.atEnd() ) ;
}
}
To copy to clipboard, switch view to plain text mode
Thanks a lot in advance!
Greetings.
Bookmarks