From 9651df184a3fb433411fe233d9e1cfe3a1960c48 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 30 Jul 2011 22:18:04 +0000 Subject: Added aux::to_uppercase() function. --- src/auxiliary/functions.cc | 6 ++++++ src/auxiliary/functions.h | 3 +++ 2 files changed, 9 insertions(+) (limited to 'src/auxiliary') 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); -- cgit v1.2.3