L
L
l2p2014-04-29 17:45:05
Qt
l2p, 2014-04-29 17:45:05

How to select any one from QStringList array that satisfies conditions?

First I add the words to the array:
mtowns << line;
Then I need to find a word that starts with a certain letter.
I do it through a loop:
for(i=0;i<count;i++)
And if it satisfies the conditions, then I show the result.
How can I make a random word output to this letter, and not just the first one that came up?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xseven, 2014-04-29
@l2p

for etc. - not the best practice, try using the standard function mtowns.filter(QRegEx("ваш образец для поиска"))
qt-project.org/doc/qt-5/qstringlist.html#filter-2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question