mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-08-03 18:26:11 -04:00
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;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool startsWith(const std::string& base, const std::string& start);
|
||||
} //namespace kiwix
|
||||
#endif
|
||||
|
@ -377,3 +377,11 @@ std::string kiwix::normalize(const std::string& 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…
x
Reference in New Issue
Block a user