X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/237f834a52db0d12c85f70c5e65f48ec1923d00a..9c6406d76392a55a85d3ec25586a47ab892b88fe:/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; +}