diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-05 15:48:26 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-05 15:48:26 +0000 |
commit | 13f789473fb59d93915f30e40433b08c4728a561 (patch) | |
tree | 815993d1b9e4d1f1339bd4ff65ca4297e101051d /include | |
parent | 7b2136db1a66dc7b06420a051214b37e15e11508 (diff) | |
download | external_llvm-13f789473fb59d93915f30e40433b08c4728a561.zip external_llvm-13f789473fb59d93915f30e40433b08c4728a561.tar.gz external_llvm-13f789473fb59d93915f30e40433b08c4728a561.tar.bz2 |
Add StringRef::endswith
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78197 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ADT/StringRef.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index 0b1bfb2..e771cd0 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -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); + } + /// @} }; |