PDA

View Full Version : QT string Find problem



kingslee
16th October 2006, 20:20
Hallo,
I used qstring find member to find a string.

but it gives error " class QString has no member named :find "

and I followed the qt documentation too.

Here is the code.
I included qstring.h



if(line.find(QRegExp("DEF"),0) != -1 && line.find(QRegExp("Shape"),0) != -1)
{
line.remove(0,line.find(QRegExp("DEF"),0)+4);

if(line.mid(0,line.find(QRegExp("Shape"),0)-1).find(QRegExp("_"),0) != -1)
{
line.remove(line.find(QRegExp("_"),1);
}
}


looking forward for ur reply.

thanks.

jacek
16th October 2006, 20:28
but it gives error " class QString has no member named :find "
Well... your compiler is right --- in Qt4 QString doesn't have any method called "find" (unless you enable the Qt3 support module). Maybe you wanted to use QString::indexOf()?

kingslee
16th October 2006, 20:45
thanks !
its worked.
I was breaking my head on this for long time ..
In documentation also, they didnt mention it ..

thank u