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 | 6e1fb1e06a738719d92e9ce3fc2545067ea82abd (patch) | |
tree | 5e1447202372f88eda8bbb6c452916bcb0773e7b | |
parent | eaccdd34a330d2f7578edbaeec924912a9325f48 (diff) | |
download | bcm5719-llvm-6e1fb1e06a738719d92e9ce3fc2545067ea82abd.tar.gz bcm5719-llvm-6e1fb1e06a738719d92e9ce3fc2545067ea82abd.zip |
Add StringRef::endswith
llvm-svn: 78197
-rw-r--r-- | llvm/include/llvm/ADT/StringRef.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h index 0b1bfb28c23..e771cd0edd5 100644 --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/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); + } + /// @} }; |