1 #include "strhelpers.h"
3 #include <algorithm>
4 #include <stdarg.h>
6 using namespace std;
8 string to_lower(const string& str)
9 {
10 string data = str;
11 transform(data.begin(), data.end(), data.begin(), ::tolower);
12 return data;
13 }
15 string sformat(const char *fmt, ...)
16 {
17 static char s_format_buf[1024];
19 va_list args;
20 va_start(args, fmt);
22 vsnprintf(s_format_buf, sizeof(s_format_buf), fmt, args);
24 va_end(args);
26 return string(s_format_buf);
27 }