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

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

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Out of scope
    • Affects Version/s: 4.3.1
    • Fix Version/s: 5.0.0
    • Labels:
      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.

        Attachments

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

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes