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>2008-05-24 16:40:06 +0000
committerStijn Buys <ingar@osirion.org>2008-05-24 16:40:06 +0000
commit274fcfe8d3fc5b54b345d79fab6dd4bbdb544892 (patch)
tree6c452ce4c5d411334024e49d67182c6402e1a0d7 /src/auxiliary
parent191a300e67edba6ae6a12a37ceb03b4f12f3ba08 (diff)
aux::lowercase, aux::to_lowercase
Diffstat (limited to 'src/auxiliary')
-rw-r--r--src/auxiliary/functions.cc14
-rw-r--r--src/auxiliary/functions.h6
2 files changed, 20 insertions, 0 deletions
diff --git a/src/auxiliary/functions.cc b/src/auxiliary/functions.cc
index 2b42bae..b417a4a 100644
--- a/src/auxiliary/functions.cc
+++ b/src/auxiliary/functions.cc
@@ -76,4 +76,18 @@ const std::string spaces(const std::string &text,size_t n)
return s;
}
+void to_lowercase(std::string &text)
+{
+ for (std::string::iterator i = text.begin(); i != text.end(); ++i)
+ (*i) = tolower(*i);
+}
+
+const std::string lowercase(const std::string &text)
+{
+ std::string t;
+ for (std::string::const_iterator i = text.begin(); i != text.end(); ++i)
+ t += tolower(*i);
+ return t;
+}
+
}
diff --git a/src/auxiliary/functions.h b/src/auxiliary/functions.h
index cd9ed13..2202b87 100644
--- a/src/auxiliary/functions.h
+++ b/src/auxiliary/functions.h
@@ -36,6 +36,12 @@ size_t text_length(const std::string &text);
/// prepend spaces to a string up to the desired lenght, excluding color codes
const std::string spaces(const std::string &text, size_t n);
+
+/// convert a string to lowercase
+void to_lowercase(std::string &text);
+
+/// return text, converted to lowercase
+const std::string lowercase(const std::string &text);
}
#endif // __INCLUDED_AUX_FUNCTIONS_H__