aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2004-06-24 23:38:52 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2004-06-24 23:38:52 +0000
commit64aed54684b205c47fda075918150d14ba4193bc (patch)
tree3eb46abb48da7c61c85f903b449839dd21d198ec
parentf54ef97abc23a14609dd3e8aea477dcce5b1b7b3 (diff)
Add a LowercaseString() utility function, courtesy of brg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14383 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/Support/StringExtras.h7
-rw-r--r--include/llvm/ADT/StringExtras.h7
2 files changed, 14 insertions, 0 deletions
diff --git a/include/Support/StringExtras.h b/include/Support/StringExtras.h
index 6b6472954e..0b45103aa3 100644
--- a/include/Support/StringExtras.h
+++ b/include/Support/StringExtras.h
@@ -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
diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h
index 6b6472954e..0b45103aa3 100644
--- a/include/llvm/ADT/StringExtras.h
+++ b/include/llvm/ADT/StringExtras.h
@@ -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