Important: Please read the Qt Code of Conduct -

Searching and deleting strings

  • Hello, I've recently joined this group and used Qt for 3 months.
    I have been coding an address book. I store data in a file and use QTreeview to display them.
    My current problem is how to search a string in a file, find it and then delete it.
    Please I need help.
    Sorry for mistake!!! English is not my mother tongue.
    Have a nice day.

  • hi!
    you might be looking for this:

    @QByteArray textData;
    QFile file(myFile);|QFile::Text);
    textData= myFile.readAll();
    QString strText(textData);


    and then use a :
    QString & QString::remove(const QString & str, Qt::CaseSensitivity cs = Qt::CaseSensitive)

    //check out QString docs

  • Thank you a lot, I am going to try it...

  • :) sure

Log in to reply