Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-1130

Support converting contents of regexp version of QString::replace() to upper- or lowercase

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Out of scope
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.0.0
    • 4.3.1
    • None

      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.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            hhartz Henrik Hartz (closed Nokia identity) (Inactive)
            sthomass Stian Sandvik Thomassen (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes