Add helper functions for string comparison to RefId

This commit is contained in:
elsid 2023-03-01 22:48:00 +01:00
parent 6518688120
commit dfcea389be
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
12 changed files with 77 additions and 15 deletions

View file

@ -176,6 +176,16 @@ namespace Misc::StringUtils
return;
str.replace(pos, substr.size(), with);
}
inline std::string_view::size_type ciFind(std::string_view str, std::string_view substr)
{
if (str.size() < substr.size())
return std::string_view::npos;
for (std::string_view::size_type i = 0, n = str.size() - substr.size() + 1; i < n; ++i)
if (ciEqual(str.substr(i, substr.size()), substr))
return i;
return std::string_view::npos;
}
}
#endif