I have a long QString
named text
, and I am looking to extract all the words in it, which have their first letter in uppercase. Is there any way to use the QString::split()
method to test each word separately ? Or even a way to do it without having to split text
?
Qt - Extracting words with the first letter in uppercase from a QString
1.8k Views Asked by Simon Defontaine At
2
What about:
The regular expression matches everything from an upper case letter forward until next capital letter. Then since you wanted all the matches you iterate through them and save them to
QVector<QString>
(orQStringList
if you so wish though it is discouraged to use).