diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2009-11-12 20:36:59 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2009-11-12 20:36:59 +0000 |
| commit | ea862b03de56f3746e10b93b4aaea3f5c781fd21 (patch) | |
| tree | 75fb85be777ac40e0c83af0712651f0da12e3fac /include/llvm/ADT/StringRef.h | |
| parent | 5b11c7069ffa39e6276b66d9dbf91ecd3844f286 (diff) | |
| download | external_llvm-ea862b03de56f3746e10b93b4aaea3f5c781fd21.zip external_llvm-ea862b03de56f3746e10b93b4aaea3f5c781fd21.tar.gz external_llvm-ea862b03de56f3746e10b93b4aaea3f5c781fd21.tar.bz2 | |
Add compare_lower and equals_lower methods to StringRef. Switch all users of
StringsEqualNoCase (from StringExtras.h) to it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87020 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/StringRef.h')
| -rw-r--r-- | include/llvm/ADT/StringRef.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index 12e2c56..269d16a 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -97,6 +97,11 @@ namespace llvm { memcmp(Data, RHS.Data, RHS.Length) == 0); } + /// equals_lower - Check for string equality, ignoring case. + bool equals_lower(StringRef RHS) const { + return Length == RHS.Length && compare_lower(RHS) == 0; + } + /// compare - Compare two strings; the result is -1, 0, or 1 if this string /// is lexicographically less than, equal to, or greater than the \arg RHS. int compare(StringRef RHS) const { @@ -110,6 +115,9 @@ namespace llvm { return Length < RHS.Length ? -1 : 1; } + /// compare_lower - Compare two strings, ignoring case. + int compare_lower(StringRef RHS) const; + /// str - Get the contents as an std::string. std::string str() const { return std::string(Data, Length); } |
