Qt:
函數QString::startsWith()
判斷一個字符串是否以某個字符串開頭。此函數具有 兩個參數,第一個參數指定了一個字符串,第二個參數指定是否大小寫敏感(默 認情況下,是大小寫敏感的),例如:
QString str="Welcome to you! ";
str.startsWith("Welcome",Qt::CaseSensitive); //返回true;
str.startsWith("you",Qt::CaseSensitive); //返回false;
函數QString::contains()
判斷一個指定的字符串是否出現過,例如:
QString str=" Welcome to you! ";
str.contains("Welcome",Qt::CaseSensitive); //返回true;
QString("12345").contains("345", Qt::CaseSensitive); //返回true;