Qt 6.11 is out! See what's new in the release
blog
QString count replacements
-
Is there a way to use
QString::replacewithQRegularExpressionand count how many times it has replaced strings?
For example, imagine that I have a string with:xaxbxc, and I want to replace "x" with "-", is there a way to know how many times `QRegularExpression' replaced? In this case it would return "3". -
hi
QString str = "banana and panama";
str.count(QRegularExpression("a[nm]a")); // returns 4