X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/9bcc50116ad21379a31ab8d65deb36688f2044b3..5d5457b414d2dd5ee77d2a17427e2c03d30ac176:/stglibs/common.lib/common.cpp

diff --git a/stglibs/common.lib/common.cpp b/stglibs/common.lib/common.cpp
index 5bd66c87..8c3eb1a5 100644
--- a/stglibs/common.lib/common.cpp
+++ b/stglibs/common.lib/common.cpp
@@ -820,6 +820,18 @@ std::string & Trim(std::string & val)
 return TrimR(TrimL(val));
 }
 //---------------------------------------------------------------------------
+std::string ToLower(std::string value)
+{
+    std::transform(value.begin(), value.end(), value.begin(), ::tolower);
+    return value;
+}
+//---------------------------------------------------------------------------
+std::string ToUpper(std::string value)
+{
+    std::transform(value.begin(), value.end(), value.begin(), ::toupper);
+    return value;
+}
+//---------------------------------------------------------------------------
 #ifdef WIN32
 static int is_leap(unsigned y)
 {
@@ -1047,3 +1059,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;
+}