Details
-
Suggestion
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.3.1
-
None
Description
It would be nice if QString::replace(const QRegExp &rx, const QString &after) supported the following escape sequences in the after string, to convert the replacement patters to upper- and lowercase, and combinations of these. For example:
\u Convert first character of replacement pattern to uppercase.
\U Convert entire replacement pattern to uppercase.
\l Convert first character of replacement pattern to lowercase.
\L Convert entire replacement pattern to lowercase.
Then in the below example, "This" and "that" would be converted to uppercase:
QRegExp rx("([a-zA-z]+)");
QString line1 = "This & that";
line1.replace(rx, "\\U
1"); // This would convert "This" and "that" to uppercase "THIS" and "THAT"
DECISION: Good idea, but this could break existing applications. We will consider it for Qt 5.