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
This commit is contained in:
Misha Brukman 2004-06-24 23:38:52 +00:00
parent f54ef97abc
commit 64aed54684
2 changed files with 14 additions and 0 deletions

View 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

View 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