diff options
author | Christopher Lamb <christopher.lamb@gmail.com> | 2007-10-18 19:31:38 +0000 |
---|---|---|
committer | Christopher Lamb <christopher.lamb@gmail.com> | 2007-10-18 19:31:38 +0000 |
commit | c5ccbdbe329af09fd34aeb097c62ce2c33296f36 (patch) | |
tree | 05f6db2c95c71bfa7c14ccd3856895b98f7bb0aa /include/llvm/ADT/StringExtras.h | |
parent | a4c791072f65b44b069a8acf17f85a3849cfb36d (diff) | |
download | llvm-c5ccbdbe329af09fd34aeb097c62ce2c33296f36.tar.gz llvm-c5ccbdbe329af09fd34aeb097c62ce2c33296f36.tar.bz2 llvm-c5ccbdbe329af09fd34aeb097c62ce2c33296f36.tar.xz |
Add an uppercase conversion utility function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43146 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/StringExtras.h')
-rw-r--r-- | include/llvm/ADT/StringExtras.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h index c7df4b6581..ae7960f16c 100644 --- a/include/llvm/ADT/StringExtras.h +++ b/include/llvm/ADT/StringExtras.h @@ -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, |