summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-05-29 08:09:45 +0200
committerGitHub <noreply@github.com>2017-05-29 08:09:45 +0200
commitb3c6d9914aaa13ed3e0aa1e0b28448ae0929f4bc (patch)
tree3dbe7b94fa09767a7f0cc8aef47bfc64e94a0395
parente0befd2f2340e2485ac92c43fd5ed80665075f77 (diff)
parentff03d846ebbe374adfbbaf0cbae45a0b3b1637b3 (diff)
Merge pull request #8978 from noshyaar/pr-sort
NaturalSort: strings start with . treated differently
-rw-r--r--core/ustring.cpp12
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)