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

Mistake in the example for QByteArray::lastIndexOf()

XMLWordPrintable

    • b8b7f98b01d9ad03fecac7a0f593ac5734d7af1d

      The example for QByteArray::lastIndexOf() contains:

      QByteArray x("crazy azimuths"); 
      QByteArray y("azy"); 
      x.lastIndexOf(y); // returns 6 
      x.lastIndexOf(y, 6); // returns 6 
      x.lastIndexOf(y, 5); // returns 2 
      x.lastIndexOf(y, 1); // returns -1 
      

      But it is definitely wrong, since there's only one "azy" substring in the string. The other is "azi", not "azy".

      Note that this problem was fixed in QString::lastIndexOf(), but was apparently forgotten for QByteArray.

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

            jasmcdon Jason McDonald (Closed Nokia Identity. Please assign to "macadder" instead) (Inactive)
            isdale Keith Isdale (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