From c1b93b0bfe2d7c4568de26af85523f83e72293d4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 6 Oct 2009 00:08:25 +0300 Subject: Hide color codes from speech text --- src/utils/stringutils.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/utils/stringutils.cpp') 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; +} -- cgit v1.2.3-70-g09d2