diff options
author | Damian Day <damianroyday@gmail.com> | 2017-05-11 20:07:59 +0100 |
---|---|---|
committer | Damian Day <damianroyday@gmail.com> | 2017-05-12 13:02:25 +0100 |
commit | f2564ca97fd6a25bc68f2e7302461970306fc837 (patch) | |
tree | 084a01ac0a8386a6dcda5cbcecee4b9ea01d03f6 /core/ustring.h | |
parent | ed6baffc72e2144b64a77cd388507072c8c2b300 (diff) |
Fix natural sorting order in EditorFileDialog, FileDialog and EditorFileSystemDirectory
Make EditorFileDialog, FileDialog and EditorFileSystemDirectory alphanumerical sorting more natural
Added a new method 'naturalnocasecmp_to' and comparator 'NaturalNoCaseComparator' to String.
Fixes #8712.
Diffstat (limited to 'core/ustring.h')
-rw-r--r-- | core/ustring.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/ustring.h b/core/ustring.h index 9ee3c2042c..d00bfa59b5 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -98,6 +98,7 @@ public: signed char casecmp_to(const String &p_str) const; signed char nocasecmp_to(const String &p_str) const; + signed char naturalnocasecmp_to(const String &p_str) const; const CharType *c_str() const; /* standard size stuff */ @@ -256,6 +257,14 @@ struct NoCaseComparator { } }; +struct NaturalNoCaseComparator { + + bool operator()(const String &p_a, const String &p_b) const { + + return p_a.naturalnocasecmp_to(p_b) < 0; + } +}; + /* end of namespace */ //tool translate |