X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/237f834a52db0d12c85f70c5e65f48ec1923d00a..be3d58dbca4e5aeb16c15983ca59a1db56b9fd7a:/stglibs/common.lib/common.cpp

diff --git a/stglibs/common.lib/common.cpp b/stglibs/common.lib/common.cpp
index 425c3ee6..2a26c5ae 100644
--- a/stglibs/common.lib/common.cpp
+++ b/stglibs/common.lib/common.cpp
@@ -1099,3 +1099,16 @@ while (done < size)
     }
 return true;
 }
+
+std::string ToPrintable(const std::string & src)
+{
+    std::string dest;
+
+    for (size_t i = 0; i < src.size(); ++i)
+        if (std::isprint(src[i]))
+            dest += src[i];
+        else
+            dest += "\\" + x2str(src[i]);
+
+    return dest;
+}