summaryrefslogtreecommitdiffstats
path: root/source/StringUtils.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-07 16:42:07 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-07 16:42:07 +0200
commit5951bc76ec8fbb188777de66cb965f05446c7f38 (patch)
tree505f8463f2d4ae553f0f7a21d3590f2089f40122 /source/StringUtils.cpp
parentFixed sprinting in 1.6.1, made speeds available through API; fixed messages containing quotes. (diff)
downloadcuberite-5951bc76ec8fbb188777de66cb965f05446c7f38.tar
cuberite-5951bc76ec8fbb188777de66cb965f05446c7f38.tar.gz
cuberite-5951bc76ec8fbb188777de66cb965f05446c7f38.tar.bz2
cuberite-5951bc76ec8fbb188777de66cb965f05446c7f38.tar.lz
cuberite-5951bc76ec8fbb188777de66cb965f05446c7f38.tar.xz
cuberite-5951bc76ec8fbb188777de66cb965f05446c7f38.tar.zst
cuberite-5951bc76ec8fbb188777de66cb965f05446c7f38.zip
Diffstat (limited to '')
-rw-r--r--source/StringUtils.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/source/StringUtils.cpp b/source/StringUtils.cpp
index 2bb6ae76e..403b10a7c 100644
--- a/source/StringUtils.cpp
+++ b/source/StringUtils.cpp
@@ -594,8 +594,8 @@ AString EscapeString(const AString & a_Message)
last = i + 1;
break;
}
- }
- }
+ } // switch (ch)
+ } // for i - a_Message[]
if (len > last)
{
EscapedMsg.append(a_Message, last, len - last);
@@ -606,3 +606,22 @@ AString EscapeString(const AString & a_Message)
+
+AString StripColorCodes(const AString & a_Message)
+{
+ AString res(a_Message);
+ size_t idx = 0;
+ while (true)
+ {
+ idx = res.find("\xc2\xa7", idx);
+ if (idx == AString::npos)
+ {
+ return res;
+ }
+ res.erase(idx, 3);
+ }
+}
+
+
+
+