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

QStringRef::right inconsistent with QString::right

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.0 RC
    • 5.3.2, 5.4.0
    • None
    • OS X 10.9.4
    • 4bf0660ae4e695ceb79f585b92dedf00d7757f31

    Description

      Code

        QString str = "rubber30";
        QStringRef ref = &str;
      
        qDebug()<<str.right(2)<<ref.right(2);
      

      Result

        "30" "bber30"
      

      Obeservation

      QString counts from the right, QStringRef counts from the left.

      "Workaround"

      Use QStringRef::mid

        qDebug()<<str.right(2)<<ref.mid(ref.length() - 2, 2);
        "30" "30"
      

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            mnaydenov Mihail Naydenov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes