Browse Source

Fix natural sorting when the common part of 2 strings ends partially in a number which continues in the uncommon part.

Closes #8080 #6732.
adaptive-webui-19844
sledgehammer999 7 years ago
parent
commit
5437974b85
No known key found for this signature in database
GPG Key ID: 6E4A2D025B7CC9A2
  1. 5
      src/base/utils/string.cpp

5
src/base/utils/string.cpp

@ -85,7 +85,10 @@ namespace @@ -85,7 +85,10 @@ namespace
const QChar leftChar = (m_caseSensitivity == Qt::CaseSensitive) ? left[posL] : left[posL].toLower();
const QChar rightChar = (m_caseSensitivity == Qt::CaseSensitive) ? right[posR] : right[posR].toLower();
if (leftChar == rightChar) {
// Compare only non-digits.
// Numbers should be compared as a whole
// otherwise the string->int conversion can yield a wrong value
if ((leftChar == rightChar) && !leftChar.isDigit()) {
// compare next character
++posL;
++posR;

Loading…
Cancel
Save