mirror of https://github.com/kiwix/libkiwix.git
Add startWith function in stringTools.h
This commit is contained in:
parent
6234457920
commit
e013d38cc6
|
@ -70,5 +70,7 @@ T extractFromString(const std::string& str) {
|
||||||
iss >> ret;
|
iss >> ret;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool startsWith(const std::string& base, const std::string& start);
|
||||||
} //namespace kiwix
|
} //namespace kiwix
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -377,3 +377,11 @@ std::string kiwix::normalize(const std::string& word)
|
||||||
{
|
{
|
||||||
return kiwix::lcAll(word);
|
return kiwix::lcAll(word);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool kiwix::startsWith(const std::string& base, const std::string& start)
|
||||||
|
{
|
||||||
|
return start.length() <= base.length()
|
||||||
|
&& std::equal(start.begin(), start.end(), base.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue