summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-10-30 18:32:26 +0000
committerRui Ueyama <ruiu@google.com>2013-10-30 18:32:26 +0000
commitf34c3ca3046378bdb7e49b7366bafca0e0bafb9a (patch)
tree5d05a659ba56b1bed812d13cd1ca638c7f2b6c2e /include
parent3f04b5068619ca0411521c9871f4bfc6b04f951f (diff)
downloadllvm-f34c3ca3046378bdb7e49b7366bafca0e0bafb9a.tar.gz
llvm-f34c3ca3046378bdb7e49b7366bafca0e0bafb9a.tar.bz2
llvm-f34c3ca3046378bdb7e49b7366bafca0e0bafb9a.tar.xz
Add {start,end}with_lower methods to StringRef.
startswith_lower is ocassionally useful and I think worth adding. endwith_lower is added for completeness. Differential Revision: http://llvm-reviews.chandlerc.com/D2041 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193706 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/StringRef.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h
index fd5b28e8fc..ec0c2849f3 100644
--- a/include/llvm/ADT/StringRef.h
+++ b/include/llvm/ADT/StringRef.h
@@ -210,12 +210,18 @@ namespace llvm {
compareMemory(Data, Prefix.Data, Prefix.Length) == 0;
}
+ /// Check if this string starts with the given \p Prefix, ignoring case.
+ bool startswith_lower(StringRef Prefix) const;
+
/// Check if this string ends with the given \p Suffix.
bool endswith(StringRef Suffix) const {
return Length >= Suffix.Length &&
compareMemory(end() - Suffix.Length, Suffix.Data, Suffix.Length) == 0;
}
+ /// Check if this string ends with the given \p Suffix, ignoring case.
+ bool endswith_lower(StringRef Suffix) const;
+
/// @}
/// @name String Searching
/// @{