Commit 2ad14ef4 authored by Brad King's avatar Brad King

cmAlgorithms: Add cmHasPrefix to match existing cmHasSuffix

parent 557b2d6e
......@@ -336,6 +336,14 @@ std::reverse_iterator<Iter> cmMakeReverseIterator(Iter it)
return std::reverse_iterator<Iter>(it);
}
inline bool cmHasPrefix(std::string const& str, std::string const& prefix)
{
if (str.size() < prefix.size()) {
return false;
}
return str.compare(0, prefix.size(), prefix) == 0;
}
inline bool cmHasSuffix(const std::string& str, const std::string& suffix)
{
if (str.size() < suffix.size()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment