From c5ccbdbe329af09fd34aeb097c62ce2c33296f36 Mon Sep 17 00:00:00 2001 From: Christopher Lamb Date: Thu, 18 Oct 2007 19:31:38 +0000 Subject: [PATCH] Add an uppercase conversion utility function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43146 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/StringExtras.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h index c7df4b65817..ae7960f16c0 100644 --- a/include/llvm/ADT/StringExtras.h +++ b/include/llvm/ADT/StringExtras.h @@ -109,6 +109,14 @@ static inline std::string LowercaseString(const std::string &S) { return result; } +static inline std::string UppercaseString(const std::string &S) { + std::string result(S); + for (unsigned i = 0; i < S.length(); ++i) + if (islower(result[i])) + result[i] = char(toupper(result[i])); + return result; +} + /// StringsEqualNoCase - Return true if the two strings are equal, ignoring /// case. static inline bool StringsEqualNoCase(const std::string &LHS,