diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-11-30 23:27:35 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-11-30 23:27:35 +0000 |
commit | 63c133b67d61b0c457ff46c957aed2b8d90b599c (patch) | |
tree | eb808ddacc2c57f6f9bbf5693e478c4221a40d90 /include/llvm/ADT/StringRef.h | |
parent | 61db62990b4bae51c5434b1a494a7ee30fd2af26 (diff) |
Support/ADT/StringRef: Add find_last_of.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120495 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/StringRef.h')
-rw-r--r-- | include/llvm/ADT/StringRef.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index 364ace7e1d..1766d2b9f2 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -256,6 +256,18 @@ namespace llvm { /// Note: O(size() + Chars.size()) size_type find_first_not_of(StringRef Chars, size_t From = 0) const; + /// find_last_of - Find the last character in the string that is \arg C, or + /// npos if not found. + size_type find_last_of(char C, size_t From = npos) const { + return rfind(C, From); + } + + /// find_last_of - Find the last character in the string that is in \arg C, + /// or npos if not found. + /// + /// Note: O(size() + Chars.size()) + size_type find_last_of(StringRef Chars, size_t From = npos) const; + /// @} /// @name Helpful Algorithms /// @{ |