Add an uppercase conversion utility function.
authorChristopher Lamb <christopher.lamb@gmail.com>
Thu, 18 Oct 2007 19:31:38 +0000 (19:31 +0000)
committerChristopher Lamb <christopher.lamb@gmail.com>
Thu, 18 Oct 2007 19:31:38 +0000 (19:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43146 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/StringExtras.h

index c7df4b6581747970c21dd95fc65241197982ca51..ae7960f16c07996081f8fb80aed1c0b806c4741a 100644 (file)
@@ -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,