Important: Please read the Qt Code of Conduct -

contain in QStringList

  • Banned

    Hej fellas,

    I am struggeling while coding and i thought maybe you can help me! ;)

    I have a QStringList which contains name, email and birthdate. And that like 10-15 times. The list gets this inofrmation from a CSV-adressbook and that all works fine.
    Now i wanna find out if a specific String is contained in the QStringList?

    I check the current Date with QDate and wanna see if the currentdate matches the Birthdate. If it mateches it should get the row:

    void datecheck::gettodayskid(QStringList list) 
        QString item;
        for(int i=0; i<list.length();i++){
            item = list[i];
    I hope someone maybe can help me!

  • Lifetime Qt Champion


    I think you are looking for QStringList::contains or rather QStringList::indexOf.

  • Banned

    Thanks a lot it seems to work! Thanks alot

Log in to reply