用QStringList的indexOf写一个匹配Good Morning的语法
QStringList list = {"Good Evening", "Good Morning", "Hello", "Hi"};
int index = list.indexOf(QRegExp("^Good\sMorning$"));
if(index == -1){ qDebug() << "No match found."; }else{ qDebug() << "Match found at index:" << index; }
//输出:Match found at index: 1
原文地址: https://www.cveoy.top/t/topic/fhz6 著作权归作者所有。请勿转载和采集!