From ff03d846ebbe374adfbbaf0cbae45a0b3b1637b3 Mon Sep 17 00:00:00 2001 From: Poommetee Ketson Date: Mon, 29 May 2017 09:56:40 +0700 Subject: NaturalSort: strings start with . treated differently --- core/ustring.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/ustring.cpp') 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) -- cgit v1.2.3