[llvm-commits] [llvm] r43146 - /llvm/trunk/include/llvm/ADT/StringExtras.h

Christopher Lamb christopher.lamb at gmail.com
Thu Oct 18 12:31:38 PDT 2007


Author: clamb
Date: Thu Oct 18 14:31:38 2007
New Revision: 43146

URL: http://llvm.org/viewvc/llvm-project?rev=43146&view=rev
Log:
Add an uppercase conversion utility function.

Modified:
    llvm/trunk/include/llvm/ADT/StringExtras.h

Modified: llvm/trunk/include/llvm/ADT/StringExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringExtras.h?rev=43146&r1=43145&r2=43146&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/StringExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/StringExtras.h Thu Oct 18 14:31:38 2007
@@ -109,6 +109,14 @@
   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, 





More information about the llvm-commits mailing list