mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Replace ciCompareLen with ciStartsWith where possible
`ciCompareLen(a, b, b.size()) == 0` expression is an equivalent of checking for equality of `a` prefix with size `b.size()` with `b`. `ciCompareLen(a, b, a.size()) == 0` is also the same thing but `a` is a prefix `b` should start with.
This commit is contained in:
parent
bf0865d03d
commit
5dc612aa54
8 changed files with 45 additions and 12 deletions
|
@ -28,6 +28,11 @@ namespace Misc::StringUtils
|
|||
[] (char l, char r) { return toLower(l) == toLower(r); });
|
||||
}
|
||||
|
||||
inline bool ciStartsWith(std::string_view value, std::string_view prefix)
|
||||
{
|
||||
return ciEqual(value.substr(0, prefix.size()), prefix);
|
||||
}
|
||||
|
||||
inline int ciCompareLen(std::string_view x, std::string_view y, std::size_t len)
|
||||
{
|
||||
std::string_view::const_iterator xit = x.begin();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue