MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / naturalCompare

Function naturalCompare

src/Engine/CrossPlatform.cpp:851–861  ·  view source on GitHub ↗

* Compares two Unicode strings using natural human ordering. * @param a String A. * @param b String B. * @return String A comes before String B. */

Source from the content-addressed store, hash-verified

849 * @return String A comes before String B.
850 */
851bool naturalCompare(const std::wstring &a, const std::wstring &b)
852{
853#if defined(_WIN32) && (!defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR))
854 return (StrCmpLogicalW(a.c_str(), b.c_str()) < 0);
855#else
856 // sorry unix users you get ASCII sort
857 std::wstring::const_iterator i, j;
858 for (i = a.begin(), j = b.begin(); i != a.end() && j != b.end() && tolower(*i) == tolower(*j); i++, j++);
859 return (i != a.end() && j != b.end() && tolower(*i) < tolower(*j));
860#endif
861}
862
863/**
864 * Moves a file from one path to another,

Callers 1

operator()Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected