Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-07-30 22:18:04 +0000
committerStijn Buys <ingar@osirion.org>2011-07-30 22:18:04 +0000
commit9651df184a3fb433411fe233d9e1cfe3a1960c48 (patch)
tree6c5962d8f13ce674b4c60339cc9c1b8f7174fd4f /src/auxiliary
parentb492615fb68e5c97fce87bcc946e92f115cfc3a2 (diff)
Added aux::to_uppercase() function.
Diffstat (limited to 'src/auxiliary')
-rw-r--r--src/auxiliary/functions.cc6
-rw-r--r--src/auxiliary/functions.h3
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);