Add a LowercaseString() utility function, courtesy of brg.
authorMisha Brukman <brukman+llvm@gmail.com>
Thu, 24 Jun 2004 23:38:52 +0000 (23:38 +0000)
committerMisha Brukman <brukman+llvm@gmail.com>
Thu, 24 Jun 2004 23:38:52 +0000 (23:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14383 91177308-0d34-0410-b5e6-96231b3b80d8

include/Support/StringExtras.h
include/llvm/ADT/StringExtras.h

index 6b6472954eefc0a4b38d06507922c3fbdad738d4..0b45103aa3bc16cb50a773b5c85439e55937b4db 100644 (file)
@@ -97,6 +97,13 @@ static inline std::string ftostr(double V) {
   return Buffer;
 }
 
+std::string LowercaseString (const std::string &S) { 
+  std::string result (S);
+  for (unsigned i = 0; i < S.length(); ++i)
+    if (isupper (result[i]))
+      result[i] = tolower(result[i]);
+  return result;
+}
 
 /// getToken - This function extracts one token from source, ignoring any
 /// leading characters that appear in the Delimiters string, and ending the
index 6b6472954eefc0a4b38d06507922c3fbdad738d4..0b45103aa3bc16cb50a773b5c85439e55937b4db 100644 (file)
@@ -97,6 +97,13 @@ static inline std::string ftostr(double V) {
   return Buffer;
 }
 
+std::string LowercaseString (const std::string &S) { 
+  std::string result (S);
+  for (unsigned i = 0; i < S.length(); ++i)
+    if (isupper (result[i]))
+      result[i] = tolower(result[i]);
+  return result;
+}
 
 /// getToken - This function extracts one token from source, ignoring any
 /// leading characters that appear in the Delimiters string, and ending the