mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 15:32:10 +08:00
cmAlgorithms: Add cmHasPrefix to match existing cmHasSuffix
This commit is contained in:
@@ -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()) {
|
||||
|
Reference in New Issue
Block a user