From c5461ec751b9eb8e55b80f4de125692fdf350fd7 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 28 Jul 2015 10:31:02 +0200 Subject: [PATCH] Doc: Increase accuracy of QString documentation discussing size() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are multiple QString and QStringRef functions that document behavior "if n is greater than size(), ...", but a comprehensive, correct statement is "if n is greater than or equal to size(), ...". Change-Id: I5d2112e08013edaf6f2f6d7e8a6740ea26a076e2 Task-number: QTBUG-47479 Reviewed-by: Topi Reiniƶ --- src/corelib/tools/qstring.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index ef87a8e3a5..345114d907 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -4270,8 +4270,8 @@ QString QString::section(const QRegularExpression &re, int start, int end, Secti Returns a substring that contains the \a n leftmost characters of the string. - The entire string is returned if \a n is greater than size() or - less than zero. + The entire string is returned if \a n is greater than or equal + to size(), or less than zero. \snippet qstring/main.cpp 31 @@ -4288,8 +4288,8 @@ QString QString::left(int n) const Returns a substring that contains the \a n rightmost characters of the string. - The entire string is returned if \a n is greater than size() or - less than zero. + The entire string is returned if \a n is greater than or equal + to size(), or less than zero. \snippet qstring/main.cpp 48 @@ -4956,7 +4956,8 @@ void QString::truncate(int pos) /*! Removes \a n characters from the end of the string. - If \a n is greater than size(), the result is an empty string. + If \a n is greater than or equal to size(), the result is an + empty string. Example: \snippet qstring/main.cpp 15 @@ -9315,8 +9316,8 @@ QString &QString::append(const QStringRef &str) Returns a substring reference to the \a n leftmost characters of the string. - If \a n is greater than size() or less than zero, a reference to the entire - string is returned. + If \a n is greater than or equal to size(), or less than zero, + a reference to the entire string is returned. \sa right(), mid(), startsWith() */ @@ -9333,8 +9334,8 @@ QStringRef QStringRef::left(int n) const Returns a substring reference to the \a n leftmost characters of the string. - If \a n is greater than size() or less than zero, a reference to the entire - string is returned. + If \a n is greater than or equal to size(), or less than zero, + a reference to the entire string is returned. \snippet qstring/main.cpp leftRef @@ -9354,8 +9355,8 @@ QStringRef QString::leftRef(int n) const Returns a substring reference to the \a n rightmost characters of the string. - If \a n is greater than size() or less than zero, a reference to the entire - string is returned. + If \a n is greater than or equal to size(), or less than zero, + a reference to the entire string is returned. \sa left(), mid(), endsWith() */ @@ -9372,8 +9373,8 @@ QStringRef QStringRef::right(int n) const Returns a substring reference to the \a n rightmost characters of the string. - If \a n is greater than size() or less than zero, a reference to the entire - string is returned. + If \a n is greater than or equal to size(), or less than zero, + a reference to the entire string is returned. \snippet qstring/main.cpp rightRef