Changes in directory llvm/include/llvm/ADT:
StringExtras.h updated: 1.26 -> 1.27 --- Log message: add some methods for case-insensitive string compares --- Diffs of the changes: (+21 -0) StringExtras.h | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: llvm/include/llvm/ADT/StringExtras.h diff -u llvm/include/llvm/ADT/StringExtras.h:1.26 llvm/include/llvm/ADT/StringExtras.h:1.27 --- llvm/include/llvm/ADT/StringExtras.h:1.26 Thu Apr 21 15:13:50 2005 +++ llvm/include/llvm/ADT/StringExtras.h Thu Jan 26 14:36:29 2006 @@ -113,6 +113,27 @@ return result; } +/// StringsEqualNoCase - Return true if the two strings are equal, ignoring +/// case. +static inline bool StringsEqualNoCase(const std::string &LHS, + const std::string &RHS) { + if (LHS.size() != RHS.size()) return false; + for (unsigned i = 0, e = LHS.size(); i != e; ++i) + if (tolower(LHS[i]) != tolower(RHS[i])) return false; + return true; +} + +/// StringsEqualNoCase - Return true if the two strings are equal, ignoring +/// case. +static inline bool StringsEqualNoCase(const std::string &LHS, + const char *RHS) { + for (unsigned i = 0, e = LHS.size(); i != e; ++i) { + if (RHS[i] == 0) return false; // RHS too short. + if (tolower(LHS[i]) != tolower(RHS[i])) return false; + } + return RHS[LHS.size()] == 0; // Not too long? +} + /// getToken - This function extracts one token from source, ignoring any /// leading characters that appear in the Delimiters string, and ending the /// token at any of the characters that appear in the Delimiters string. If _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits