[Interest] documentation for QString::right(int n) confuse

Constantin Makshin cmakshin at gmail.com
Tue Jun 4 06:21:51 CEST 2013


If 'x' is equal to "Pineapple", then
x[0] = 'P'
x[1] = 'i'
x[2] = 'n'
x[3] = 'e'
x[4] = 'a'
x[5] = 'p'
x[6] = 'p'
x[7] = 'l'
x[8] = 'e'

No offence, but I don't understand how the phrase "n rightmost characters"
can be confusing to anyone. :-)
On Jun 4, 2013 7:39 AM, "Duan,Lin" <linduan at isoftstone.com> wrote:

>  here it says:****
> ------------------------------------------------------------------------------------------------
> **** QString QString::right(int* n*) const****
>
> Returns a substring that contains the *n* rightmost characters of the
> string.****
>
> The entire string is returned if *n* is greater than size<http://qt-project.org/doc/qt-5.0/qtcore/qstring.html#size>()
> or less than zero.****
>
> QString <http://qt-project.org/doc/qt-5.0/qtcore/qstring.html> x = "Pineapple";****
>
> QString <http://qt-project.org/doc/qt-5.0/qtcore/qstring.html> y = x.right(5);      // y == "apple"****
>
> ** **
>
> ------------------------------------------------------------------------------------------------
> ****
>
> I make a mistake for that today.****
>
> ** **
>
> because there was the same for result string “apple”,****
>
> either from left to right counting 5, or from right to left counting 5.***
> *
>
> Only watched the example, but not read the illustration above.****
>
> I deem the 5 is the index for the string.****
>
> ** **
>
> the example for doc should be better?:****
>
> QString <http://qt-project.org/doc/qt-5.0/qtcore/qstring.html> x = "ThereHaveOneApple";****
>
> QString <http://qt-project.org/doc/qt-5.0/qtcore/qstring.html> y = x.right(5);      // y == "Apple"****
>
> ** **
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130604/d09e304a/attachment.html>


More information about the Interest mailing list