summaryrefslogtreecommitdiff
path: root/src/corelib/text/qstring.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-01-13 01:00:45 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-01-13 01:00:45 +0100
commit8d0715f106afb315ad8c2a68ceea09e82decc86f (patch)
tree5a5efba87b5a5aa73b1493320677f6c0c8547f76 /src/corelib/text/qstring.cpp
parent76c4c5d5581b2cd36a043234eb167dd55041301d (diff)
parent3d1e257770e8c79c7cd9a08f9caf1bd8395cb10c (diff)
downloadqtbase-8d0715f106afb315ad8c2a68ceea09e82decc86f.tar.gz
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I50f70a789ab1438b40d4408be72c090fa00b801f
Diffstat (limited to 'src/corelib/text/qstring.cpp')
-rw-r--r--src/corelib/text/qstring.cpp44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 5788f000a1..720c3e98c7 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -5123,21 +5123,25 @@ bool QString::endsWith(QChar c, Qt::CaseSensitivity cs) const
}
/*!
- Returns \c true if the string only contains uppercase letters,
- otherwise returns \c false.
+ Returns \c true if the string is uppercase, that is, it's identical
+ to its toUpper() folding.
+
+ Note that this does \e not mean that the string does not contain
+ lowercase letters (some lowercase letters do not have a uppercase
+ folding; they are left unchanged by toUpper()).
+ For more information, refer to the Unicode standard, section 3.13.
+
\since 5.12
- \sa QChar::isUpper(), isLower()
+ \sa QChar::toUpper(), isLower()
*/
bool QString::isUpper() const
{
- if (isEmpty())
- return false;
+ QStringIterator it(*this);
- const QChar *d = data();
-
- for (int i = 0, max = size(); i < max; ++i) {
- if (!d[i].isUpper())
+ while (it.hasNext()) {
+ uint uc = it.nextUnchecked();
+ if (qGetProp(uc)->cases[QUnicodeTables::UpperCase].diff)
return false;
}
@@ -5145,21 +5149,25 @@ bool QString::isUpper() const
}
/*!
- Returns \c true if the string only contains lowercase letters,
- otherwise returns \c false.
+ Returns \c true if the string is lowercase, that is, it's identical
+ to its toLower() folding.
+
+ Note that this does \e not mean that the string does not contain
+ uppercase letters (some uppercase letters do not have a lowercase
+ folding; they are left unchanged by toLower()).
+ For more information, refer to the Unicode standard, section 3.13.
+
\since 5.12
- \sa QChar::isLower(), isUpper()
+ \sa QChar::toLower(), isUpper()
*/
bool QString::isLower() const
{
- if (isEmpty())
- return false;
+ QStringIterator it(*this);
- const QChar *d = data();
-
- for (int i = 0, max = size(); i < max; ++i) {
- if (!d[i].isLower())
+ while (it.hasNext()) {
+ uint uc = it.nextUnchecked();
+ if (qGetProp(uc)->cases[QUnicodeTables::LowerCase].diff)
return false;
}