2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 01:07:43 +00:00

string_view refactor

This commit is contained in:
Jack Andersen
2017-11-12 20:19:18 -10:00
parent 742ab2514f
commit f7ec7bdc0c
345 changed files with 907 additions and 921 deletions

View File

@@ -18,14 +18,14 @@ public:
return strcasecmp(a, b);
#endif
}
static int CompareCaseInsensitive(const std::string& a, const std::string& b)
static int CompareCaseInsensitive(std::string_view a, std::string_view b)
{
return CompareCaseInsensitive(a.c_str(), b.c_str());
return CompareCaseInsensitive(a.data(), b.data());
}
static int IndexOfSubstring(const std::string& haystack, const std::string& needle)
static int IndexOfSubstring(std::string_view haystack, std::string_view needle)
{
std::string str = haystack;
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)