diff --git a/Runtime/CStringExtras.hpp b/Runtime/CStringExtras.hpp index 399030d82..bd022ce09 100644 --- a/Runtime/CStringExtras.hpp +++ b/Runtime/CStringExtras.hpp @@ -29,10 +29,12 @@ public: static int IndexOfSubstring(std::string_view haystack, std::string_view needle) { std::string str(haystack); - std::transform(str.begin(), str.end(), str.begin(), tolower); - std::string::size_type s = str.find(needle); - if (s == std::string::npos) + std::transform(str.begin(), str.end(), str.begin(), + [](char c) { return std::tolower(static_cast(c)); }); + const std::string::size_type s = str.find(needle); + if (s == std::string::npos) { return -1; + } return s; } };