summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2009-10-06 00:08:25 +0300
committerJared Adams <jaxad0127@gmail.com>2009-10-05 16:53:21 -0600
commitc1b93b0bfe2d7c4568de26af85523f83e72293d4 (patch)
treef446a5e256fc5e63f34c6a7b91a5e414b7c8ae2e /src/utils/stringutils.cpp
parent8a70da0e01e8cd6fd3b9b443bde45729b44a480b (diff)
downloadmana-client-c1b93b0bfe2d7c4568de26af85523f83e72293d4.tar.gz
mana-client-c1b93b0bfe2d7c4568de26af85523f83e72293d4.tar.bz2
mana-client-c1b93b0bfe2d7c4568de26af85523f83e72293d4.tar.xz
mana-client-c1b93b0bfe2d7c4568de26af85523f83e72293d4.zip
Hide color codes from speech text
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index c9428974..64d928d6 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -105,3 +105,15 @@ std::string &removeBadChars(std::string &str)
return str;
}
+
+std::string removeColors(std::string msg)
+{
+ for (unsigned int f = 0; f < msg.length() - 2 && msg.length() > 2; f++)
+ {
+ while (msg.length() > f + 2 && msg.at(f) == '#' && msg.at(f + 1) == '#')
+ {
+ msg = msg.erase(f, 3);
+ }
+ }
+ return msg;
+}