diff options
-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); |