diff options
author | Stijn Buys <ingar@osirion.org> | 2011-07-30 22:18:04 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-07-30 22:18:04 +0000 |
commit | 9651df184a3fb433411fe233d9e1cfe3a1960c48 (patch) | |
tree | 6c5962d8f13ce674b4c60339cc9c1b8f7174fd4f | |
parent | b492615fb68e5c97fce87bcc946e92f115cfc3a2 (diff) |
Added aux::to_uppercase() function.
-rw-r--r-- | src/auxiliary/functions.cc | 6 | ||||
-rw-r--r-- | src/auxiliary/functions.h | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/auxiliary/functions.cc b/src/auxiliary/functions.cc index 47f7fb2..ce31587 100644 --- a/src/auxiliary/functions.cc +++ b/src/auxiliary/functions.cc @@ -119,6 +119,12 @@ const std::string pad_right(const std::string &text, size_t n) return s; } +void to_uppercase(std::string &text) +{ + for (std::string::iterator i = text.begin(); i != text.end(); ++i) + (*i) = toupper(*i); +} + void to_lowercase(std::string &text) { for (std::string::iterator i = text.begin(); i != text.end(); ++i) diff --git a/src/auxiliary/functions.h b/src/auxiliary/functions.h index aeaa201..2d14542 100644 --- a/src/auxiliary/functions.h +++ b/src/auxiliary/functions.h @@ -55,6 +55,9 @@ const std::string pad_left(const std::string &text, size_t n); /// append spaces to a string up to the desired lenght, excluding color codes const std::string pad_right(const std::string &text, size_t n); +/// convert a string to uppercase +void to_uppercase(std::string &text); + /// convert a string to lowercase void to_lowercase(std::string &text); |