QString str1 = "hello world"; if (str1.endsWith("world")) { qDebug() << "The string ends with 'world'"; }
QString str2 = "Hello, qt!"; if (str2.endsWith("Qt", Qt::CaseInsensitive)) { qDebug() << "The string ends with 'Qt'"; }This example checks whether the string ends with the substring "Qt", ignoring case sensitivity. The second parameter of the endsWith() function is used to specify the matching options. The QString class is part of the Qt Core module.