summaryrefslogtreecommitdiff
path: root/kms++util/strhelpers.cpp
blob: f18c749b99586f6a9add2360fe3e0823c11a5e5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
}