i just want to know if there is a way for a loop to be on the If statement condition?
sample:
if((string.contains(stringlist.hello().value(0),Qt::CaseInsensitive))||(string.contains(stringlist.hello().value(1),Qt::CaseInsensitive))||(string.contains(stringlist.hello().value(2),Qt::CaseInsensitive)))
{
...
}
to be:
if
(
for(int i=0; i < stringlist.hello().size(); i++)
{
string.contains(stringlist.hello().value(i),Qt::CaseInsensitive)
}
)
{
...
}
by the way hello() function retrieves list of data from the database.
the purpose of this program is to check a string if it contains some keywords from the database.
That code will not compile; instead, you might try a solution that checks each condition and stores the result into a variable determining whether or not the condition is met:
I changed my code to use bool instead of int’s, as it looks like you are using C++.