Add StringRef::endswith

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78197 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-08-05 15:48:26 +00:00
parent e15192b36b
commit c9af366fc3

View File

@ -174,6 +174,11 @@ namespace llvm {
return substr(0, Prefix.Length).equals(Prefix);
}
/// endswith - Check if this string ends with the given \arg Suffix.
bool endswith(const StringRef &Suffix) const {
return slice(size() - Suffix.Length, size()).equals(Suffix);
}
/// @}
};