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