[llvm-commits] [llvm] r78197 - /llvm/trunk/include/llvm/ADT/StringRef.h

Daniel Dunbar daniel at zuster.org
Wed Aug 5 08:48:38 PDT 2009


Author: ddunbar
Date: Wed Aug  5 10:48:26 2009
New Revision: 78197

URL: http://llvm.org/viewvc/llvm-project?rev=78197&view=rev
Log:
Add StringRef::endswith

Modified:
    llvm/trunk/include/llvm/ADT/StringRef.h

Modified: llvm/trunk/include/llvm/ADT/StringRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=78197&r1=78196&r2=78197&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/StringRef.h (original)
+++ llvm/trunk/include/llvm/ADT/StringRef.h Wed Aug  5 10:48:26 2009
@@ -174,6 +174,11 @@
       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);
+    }
+
     /// @}
   };
 





More information about the llvm-commits mailing list