Try to improve CompareStrings() documentation

Explain why this function should be used and give an example of how this
function works in different locales.
This commit is contained in:
Vadim Zeitlin
2021-09-01 02:12:12 +02:00
parent e6cebb27f1
commit 836f5abc3d

View File

@@ -116,6 +116,15 @@ public:
/** /**
Compares two strings using comparison rules of this locale. Compares two strings using comparison rules of this locale.
This function is useful for sorting the strings in the order expected
by the user, e.g. by correctly sorting "ä" in the same way as "a" when
using German locale, but not when using Swedish one, in which "ä" is
sorted after "z".
It can be used both with the current locale, and with any other
supported locale, even under systems not supporting changing the UI
locale, such as macOS.
@param lhs @param lhs
First comparing string. First comparing string.
@param rhs @param rhs
@@ -126,9 +135,9 @@ public:
that this flag only works under MSW and Mac and is simply ignored that this flag only works under MSW and Mac and is simply ignored
under the other platforms). under the other platforms).
@return @return
-1 if lhs less than rhs. -1 if @a lhs is less than @a rhs.
0 if lhs equal to rhs. 0 if @a lhs is equal to @a rhs.
1 if lhs greater than rhs. 1 if @a lhs is greater than @a rhs.
*/ */
int CompareStrings(const wxString& lhs, const wxString& rhs, int CompareStrings(const wxString& lhs, const wxString& rhs,
int flags = wxCompare_CaseSensitive) const; int flags = wxCompare_CaseSensitive) const;