mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Add helper functions for string comparison to RefId
This commit is contained in:
parent
6518688120
commit
dfcea389be
12 changed files with 77 additions and 15 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue