summaryrefslogtreecommitdiff
path: root/kms++util/strhelpers.cpp
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-11 20:17:35 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-11 20:17:35 +0300
commit17d180891f1e237ea5d25835999a8b23a6e7946d (patch)
tree5963fe4d338f6272daf55c76ed355effb47afc71 /kms++util/strhelpers.cpp
parent38a71ee72c47f3287c327113ce411f236cac05ef (diff)
rename dirs
Diffstat (limited to 'kms++util/strhelpers.cpp')
-rw-r--r--kms++util/strhelpers.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/kms++util/strhelpers.cpp b/kms++util/strhelpers.cpp
new file mode 100644
index 0000000..f18c749
--- /dev/null
+++ b/kms++util/strhelpers.cpp
@@ -0,0 +1,27 @@
+#include "strhelpers.h"
+
+#include <algorithm>
+#include <stdarg.h>
+
+using namespace std;
+
+string to_lower(const string& str)
+{
+ string data = str;
+ transform(data.begin(), data.end(), data.begin(), ::tolower);
+ return data;
+}
+
+string sformat(const char *fmt, ...)
+{
+ static char s_format_buf[1024];
+
+ va_list args;
+ va_start(args, fmt);
+
+ vsnprintf(s_format_buf, sizeof(s_format_buf), fmt, args);
+
+ va_end(args);
+
+ return string(s_format_buf);
+}