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

用QStringList的indexOf写一个匹配Good Morning的语法

原文地址: https://www.cveoy.top/t/topic/fhz6 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录