aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/string.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/zencore/include/zencore/string.h b/zencore/include/zencore/string.h
index 23193501c..7af27ca20 100644
--- a/zencore/include/zencore/string.h
+++ b/zencore/include/zencore/string.h
@@ -696,6 +696,19 @@ ForEachStrTok(const std::string_view& Str, char Delim, Fn&& Func)
//////////////////////////////////////////////////////////////////////////
+inline int32_t
+StrCaseCompare(const char* Lhs, const char* Rhs, int64_t Length=-1)
+{
+ // A helper for cross-platform case-insensitive string comparison.
+#if ZEN_PLATFORM_WINDOWS
+ return (Length < 0) ? _stricmp(Lhs, Rhs) : _strnicmp(Lhs, Rhs, size_t(Length));
+#else
+ return (Length < 0) ? strcasecmp(Lhs, Rhs) : strncasecmp(Lhs, Rhs, size_t(Length));
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////
+
/**
* ASCII character bitset useful for fast and readable parsing
*