diff options
author | Poommetee Ketson <poommetee@protonmail.com> | 2017-05-29 09:56:40 +0700 |
---|---|---|
committer | Poommetee Ketson <poommetee@protonmail.com> | 2017-05-29 09:59:02 +0700 |
commit | ff03d846ebbe374adfbbaf0cbae45a0b3b1637b3 (patch) | |
tree | 1586d5b70718839796443f5060d6b403689e5d84 /core | |
parent | bb20f230ad307a2a5f18c03bece3793d29ae208a (diff) |
NaturalSort: strings start with . treated differently
Diffstat (limited to 'core')
-rw-r--r-- | core/ustring.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 7a5129962b..6a93d7789e 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -489,6 +489,18 @@ signed char String::naturalnocasecmp_to(const String &p_str) const { const CharType *that_str = p_str.c_str(); if (this_str && that_str) { + + while (*this_str == '.' || *that_str == '.') { + if (*this_str++ != '.') + return 1; + if (*that_str++ != '.') + return -1; + if (!*that_str) + return 1; + if (!*this_str) + return -1; + } + while (*this_str) { if (!*that_str) |