QString count replacements
Solved
General and Desktop
-
Is there a way to use
QString::replace
withQRegularExpression
and 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