I want to use switch-case in my program but the compiler gives me this error:
switch expression of type \'QString\' is illegal
How can I us
As previously noted this is not a Qt problem, switch statements can only use constant expressions, look at the collection classes a QSet is a good solution
void initStopQwords(QSet& stopSet)
{
// Ideally you want to read these from a file
stopSet << "the";
stopSet << "at";
...
}
bool isStopWord(const QSet& stopSet, const QString& word)
{
return stopSet.contains(word);
}