diff options
| author | Dan Engelbrecht <[email protected]> | 2022-05-12 12:16:03 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-05-12 12:16:03 +0200 |
| commit | e45d87b8834d204a130f09daf9009b85f3cd32ef (patch) | |
| tree | 2515a259075a46745e71b62abfadee293eefe9c8 /zencore/include | |
| parent | string_view vs string lifetime fix (diff) | |
| download | zen-e45d87b8834d204a130f09daf9009b85f3cd32ef.tar.xz zen-e45d87b8834d204a130f09daf9009b85f3cd32ef.zip | |
use string::compare in caseSensitiveCompareStrings
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/string.h | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/zencore/include/zencore/string.h b/zencore/include/zencore/string.h index fe838ac19..92f567dae 100644 --- a/zencore/include/zencore/string.h +++ b/zencore/include/zencore/string.h @@ -807,15 +807,8 @@ StrCaseCompare(const char* Lhs, const char* Rhs, int64_t Length = -1) inline auto caseSensitiveCompareStrings(const std::string& Lhs, const std::string& Rhs) { - if (Lhs == Rhs) - { - return std::strong_ordering::equal; - } - if (Lhs < Rhs) - { - return std::strong_ordering::less; - } - return std::strong_ordering::greater; + int r = Lhs.compare(Rhs); + return r == 0 ? std::strong_ordering::equal : r < 0 ? std::strong_ordering::less : std::strong_ordering::greater; } ////////////////////////////////////////////////////////////////////////// |